Debian – Mount CIFS Share with Spaces in fstab

cifsdebianfstabnetwork-share

I'm running a Debian Squeeze system and trying to mount a windows share in /etc/fstab. I've got an existing cifs mount working, but it's a simple //xx.xx.xx.xx/sharename situation. This second one isn't working however.

The issue – the second share has white spaces in the path… multiple ones!

The line in fstab is:

//servername.org.au/ABC/Company Services/Department Services/Area Services/Restricted    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

So far I've tried:

Double quotes around the path names in fstab

//servername.org.au/ABC/"Company Services/Department Services/Area Services/Restricted"    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

Replacing the space with \040 (like in Linux)

//servername.org.au/ABC/Company\040Services/Department\040Services/Area\040Services/Restricted     /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

Escape with backslash

//servername.org.au/ABC/Company\ Services/Department\ Services/Area\ Services/Restricted    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

None of these worked.

I've verified the directory is valid, I've tried replacing the servername.org.au with the IP it resolves to and that didn't help either.

The error I'm getting in kern.log is:

kernel: [1830446.002198] CIFS VFS: cifs_mount failed w/return code = -22

That's it – not a lot of detail to go on…

I'm using the EXACT same syntax and credentials for both mounts. I KNOW the credentials are valid and working because I use them to connect to the same share on my Windows box. I'd change the share name, but unfortunately it's not one of MY servers and they won't do it.

So I'm just gonna strap these two danishes to the side of my head and say:

Help Me Obi-Stack-Exchange!
You're my only hope!

Thanks in advance!

(Edit: removed errant quotation marks in one of the examples)

Best Answer

Replacing the spaces with \040 is actually the right way to do it.

The reason why it’s not working for you is probably because there are (forgotten?) quotes after /Restricted:

//servername.org.au/ABC/Company\040Services/…/Restricted"    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

Change that to:

//servername.org.au/ABC/Company\040Services/…/Restricted    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

(Note that I’ve shortened the path a bit for better readability.)


Background: 040 is the ASCII code for space in octal numeral system.