Skip to main content
Question

Escaping special charactor in mount command

  • May 5, 2022
  • 2 replies
  • 29 views

Forum|alt.badge.img+7

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

Forum|alt.badge.img+10
  • Valued Contributor
  • May 6, 2022

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


Fluffy
Forum|alt.badge.img+10
  • Honored Contributor
  • May 6, 2022

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.