Re: New mounting script

Skip to first unread message

Jonathan K. Bullard

Oct 14, 2012, 4:55:45 PM10/14/12
Thanks! I will put a link to your post in the writeup for the existing script.

On Sun, Oct 14, 2012 at 4:08 PM, Denis Loginov wrote:


I've been trying to auto-mount CIFS/SMB shares using but the script failed. Then I started this script manually from Terminal, and it asked me for the password for my CIFS account, even though I previously saved in in Keychain.

Turns out, to be able to access Keychain, we need to use Apple Scripts. Here's a way to do so:


su <USERNAME> -c '

osascript -e "mount volume \"smb://<DOMAIN>\<USER>@<SERVER>/<SHARE>\""


# open /Volumes/<NAME>

Note that there is no need to use mkdir or specify a mount point, as the Mac will automatically do that for us.


You received this message because you are subscribed to the Google Groups "tunnelblick-discuss" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Jun 8, 2016, 5:43:15 PM6/8/16
to tunnelblick-discuss
I know that this post is quite old, but I'm having trouble trying to implement it.  

mount volume script will run without issues and the VPN connects.  However, the volume does not actually mount.  I tried using "open location" instead of "mount volume" and it will work fine.  If I write a quick script in Script Editor, mount volume works as expected.  It just doesn't seem to work when executed from  

Does anyone have any suggestions?
To unsubscribe from this group, send email to

Jun 8, 2016, 6:00:20 PM6/8/16
to tunnelblick-discuss,
I can only offer a couple of general suggestions:

1. Add lines like
echo "something" >> /tmp/
to your script to get a log of what happens with each command in the script.

2. Check the error status of each command in the script by using the "$?" bash construct.

3. Remember that the script runs as root, not as the user. The username is available in the Environment Variables.
Reply all
Reply to author
0 new messages