Escaping special charactor in mount command

MehdiYawari
New Contributor III

Hallo Everyone
I am struggling with the mount command for some times now. I can't mount our Distribution Point, as we have a unique username. to scape a special charactor in password, we use the command this way: mount_smbfs //user:"password"@server /mount path which work like a charm. But this doesn't work for the username.
this is how our username looks like: SA_JSS_XXXXX@sss0000.share.com 

using command like:

mount -t smbfs //username:password@jss.company.com/ /Volumes/test/ 
mount -t smbfs //"username":password@jss.company.com/ /Volumes/test/

mount -t smbfs //'username':password@jss.company.com/ /Volumes/test/
mount -t smbfs //sss0000.share.com;SA_JSS_XXXXX:password@jss.company.com /mount path

didn't work for me
Can someone tell how I can escape this?

Thanks 

2 REPLIES 2

sgiesbrecht
Contributor III

using password in plain text is not safe.  You should use https://github.com/kc9wwh/EncryptedStrings to (en/de)crypt passwords

Fluffy
Contributor III

I would try either quoting the entire string, putting it in as a variable, or both.

 

mount -t smbfs "//username:password@jss.company.com/" /Volumes/test/
USERNAME="username"
PASSWORD="password"

mount -t smbfs //"$USERNAME":"$PASSWORD"@jss.company.com/ /Volumes/test/
USERNAME="username"
PASSWORD="password"

mount -t smbfs "//$USERNAME:$PASSWORD@jss.company.com/" /Volumes/test/ 

 

 

I agree with @sgiesbrecht that you will want to be careful with the passwords.