[SOLVED] Unable to mount Windows share containing whitespace
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Unable to mount Windows share containing whitespace
Hey all, I'm trying to mount a Windows share that contains white space and I'm not having any luck. Here's my mount command:
Code:
mount -t cifs //Server1/Shares/Not Shared -o username=jobee,password=MyPass /mnt/Windows
I can mount my Shared share so permissions and such are all ok. I've tried enclosing the entire UNC path in quotes and worked my way down to just Not Shared. I've even used \040 instead of the white space but no joy. Googling this tells me people are using quotes or the \040 but they aren't working for me. Any ideas, suggestions or recommendations?
Quotes should work. Is your share actually called "Not Shared"? Because that's the default text in Windows for folders that are, well, not shared at all.
Does name resolution work? Does host server1 return server1's IP address?
Does ping server1 work?
What's the exact error message you're seeing? Are there any CIFS-related errors in the logs? (Try dmesg | tail)
Hi Ser Olmy, here's what I'm seeing with your suggestions:
Quote:
Originally Posted by Ser Olmy
Quotes should work. Is your share actually called "Not Shared"? Because that's the default text in Windows for folders that are, well, not shared at all.
Yes, it's actually called "Not Shared." Mount can see it because if I remove "Shares" from the path I get a "No such device or address" error message.
Quote:
Originally Posted by Ser Olmy
Does name resolution work? Does host server1 return server1's IP address?
Name resolution works fine; host returns the IP address.
Quote:
Originally Posted by Ser Olmy
Does ping server1 work?
Pinging the server works just fine too.
Quote:
Originally Posted by Ser Olmy
What's the exact error message you're seeing?
That's part of my problem -- there are no error messages. I type in the mount string, hit ENTER and all I see is a carriage return. When I pull an ls -l on the mounted share there's nothing there.
Quote:
Originally Posted by Ser Olmy
Are there any CIFS-related errors in the logs? (Try dmesg | tail)
The \040 is an ASCII space character in octal (32 in decimal, 20 in hexadecimal). I haven't tried it, but I found mention of it on a google search. It was for a mount in fstab.
EDIT: I figured it out. For a command line mount, just escape the space normally. In other words, just put a backslash in front of the space:
Code:
mount -t cifs //Server1/Shares/Not\ Shared -o username=jobee,password=MyPass /mnt/Windows
Last edited by Z038; 07-10-2013 at 05:16 PM.
Reason: figured out how to do it
I actually asked a rather stupid question about the share name in my last post, since you're not actually mounting a share called "Not Shared", but a subfolder under a share called "Shares". And it does not matter one iota whether that folder is shared or not, as long as the parent folder is.
I've just done a little testing, and I can confirm that:
the cifs subsystem is capable of mounting subfolders (at least in kernel 3.9.9 with a reasonably new cifs-utils package)
you can have spaces in the mount path as long as you use quotes ("\\Server\Share\name with whitespace") or escape it with a backslash
So, given that name resolution works and the correct permissions are set on the share and the folder, this most definitely should work:
Code:
mount -t cifs "//Server1/Shares/Not Shared" -o username=jobee,password=MyPass /mnt/Windows
What does mount.cifs -V report? And which kernel version are you running?
That's a slightly old kernel, and your cifs-utils (mount.cifs et al) package is a major version behind the one I'm using, 5.5.
I can't say definitely that either the kernel or cifs-utils are causing this problem, but I can say that I'm not having any trouble mounting a subfolder with a name containing spaces using version 5.5 of cifs-utils and a recent kernel.
The syntax-related error message in the log seems to point in the direction of cifs-utils. If a more recent package is available for your distribution, you could try upgrading.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.