Mount SMB share from a server with a space in its name

Jawap picture Jawap · Apr 5, 2013 · Viewed 9k times · Source

I'm trying to mount an SMB share on the terminal. I'm able do to that, if the server has no space in its name using this command:

$ mount -t smbfs //user:password@server/resource /Volumes/resource

However in my case the server name has a space and I can't figure out how to properly pass such a name.

I tried using double or single quotes:

$ mount -t smbfs "//user:password@ser ver/resource" /Volumes/resource
mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument

I tried escaping the space:

$ mount -t smbfs //user:password@ser\ ver/resource /Volumes/resource
mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument

I also tried using %20, \x20 and \040, but I get an error:

mount_smbfs: server connection failed: No route to host

I know I could use the IP address or rename the server, but that would be a workaround and not a solution and I'm wondering what I'm missing.

Answer

Bobulous picture Bobulous · Apr 5, 2013

What happens if you combine quotes and escape:

mount -t smbfs "//user:password@ser\ ver/resource" /Volumes/resource

That reportedly worked for someone when mounting an smbfs volume with a space in the username.