Escape special characters in mount command

Karthick picture Karthick · Nov 19, 2014 · Viewed 13.4k times · Source

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

Answer

Longfei Wu picture Longfei Wu · May 12, 2016

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