mount_smbfs fails if password contains '@'

I am using mount_smbfs command in a shell script like this:
mount_smbfs -W <work-group> '//<user-name>:<password>@<host-name>/<share>' <mount-point>
But, if the password has the character '@', the command fails.
For example: mount_smbfs -W <workgroup1> '//user1:abcd@xy@hostname1/sharename1' /abcd/def
(Where password = abcd@xy
hostname = hostname1)
The command fails with the error -
mount_smbfs: can't get server address `xy@hostname1':
Unknown host
mount_smbfs: can't get server address: syserr = Network is down

Is there a way to overcome this problem?

MAC 10.4, Mac OS X (10.4.11)

Posted on Dec 8, 2009 10:40 PM

Reply
5 replies

Dec 8, 2009 11:14 PM in response to Sailaja

There might be a few things worth trying:
* Don't use quotes at all and escape the @ character in the password:
//user1:abcd@xy@hostname1/sharename1

* Quote just the password:
//user1:'abcd@xy'@hostname1/sharename1

* Use double quotes and escape the @ character
"//user1:abcd@xy@hostname1/sharename1"

* Make the mount command ask for the password interactively
mount_smbfs -N -W <workgroup1> //user1:@hostname1/sharename1 /abcd/def

* If nothing else works then consider changing the password. 😉
Maybe one of them will work.

Dec 9, 2009 5:14 AM in response to Sailaja

Let's see… Try escaping the @ with two backslashes to see if that works:
//user1:abcd\@xy@hostname1/sharename1

If that doesn't work you might have to create/modify the ~/Library/Preferences/nsmb.conf or /etc/nsmb.conf file and store the password there. If it comes to that then here's an [article|http://onlamp.com/bsd/2001/11/15/Big ScaryDaemons.html] that I found through a search engine that might be useful.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

mount_smbfs fails if password contains '@'

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.