Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a shell script that mounts several samba shares one after the other. I want my users to have to enter in their password only once. I can pass in a password using the following,

mount -v -t smbfs -o nodev,nosuid //$user:$pass@my.host.com:/share /Volumes/share

This doesn't work when there are weird characters such as '^' or '.' in the password.

Any ideas?

share|improve this question
    
Why not using @$host –  Prix Aug 13 '10 at 23:52
add comment

4 Answers

You can either use the user and password options for the mount.cifs command (see man page mount.cifs(8)) like mount -o ...,user="foo",password="bar" //example.com:/share or you use the credentials option to provide the path to a file containing the user credentials (also see mount.cifs(8)).

share|improve this answer
add comment

You have to URL encode the special characters (weird characters) on a Mac, because "mount_smbfs: -o user: option not supported". So, in your example, '^' = %5E

URL Encoding here: http://www.w3schools.com/tags/ref_urlencode.asp

share|improve this answer
add comment

Have you tried enclosing the password phrases in quotes?

share|improve this answer
    
rather single quotes –  greenmang0 Aug 14 '10 at 5:58
add comment

Try to surround the entire options expression with quotes, i.e. mount -v -o "...".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.