Reputation: 285
I am trying to mount a windows shared folder on Mac OSX Mavericks. A simplistic user name and password worked fine
mount -t smbfs //user2:[email protected]/myproject ~/localmap
On trying out the more valid user name and password I am getting errors that parsing URL failed. The details are Username: mydomain\user1 Password: A%b$c@d!e#f
The command tried is
mount -t smbfs //mydomain\user1:A%b\$c\@d\!e#[email protected]/myproject ~/localmap
Based on what I found, $ and ! needs to be escaped. Need help on how to escape the special characters. Incidentally, using only the username without the domain seems to work in the first case
Upvotes: 11
Views: 23834
Reputation: 108
Might be handy to use nodejs to encode the url stuff:
$ node -e 'console.log(encodeURIComponent("A%b$c@d!e#f"))'
A%25b%24c%40d!e%23f
Decode to go the other way:
$ node -e 'console.log(decodeURIComponent("A%25b%24c%40d!e%23f"))'
A%b$c@d!e#f
Upvotes: 2
Reputation: 845
Just encode your special characters.
@ -> %40
$ -> %24
! -> %21
Others characters can be found here: http://www.degraeve.com/reference/urlencoding.php
e.g.
username="someone", password="passw@rd"
Then this should work for you:
mount -t smbfs //someone:passw%40rd@server/path /Volumes/path
Upvotes: 8
Reputation: 4837
Use \
to escape special symbols
if you want to convert some special symbols you can write additional string, where $1 - is parameter you provide for converting
user1=$(sed -e "s/+/%2B/g;s/@/%40/g;s/_/%5F/g" <<< "$1")
and then you can use " "
and call your converted variable like this $user1
Upvotes: 3
Reputation: 39354
Single quotes escape shell meta-characters, a semi-colon should separate the domain controller from the credentials, and can use %40
to represent an @
in the password:
mount -t smbfs '//mydomain;user1:A%b$c%40d!e#[email protected]/myproject' ~/localmap
Upvotes: 8