LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Can't automount smb with spaces (https://www.linuxquestions.org/questions/linux-networking-3/cant-automount-smb-with-spaces-172819/)

chasn 04-21-2004 06:43 AM

Can't automount smb with spaces
 
7 day newbie here. Spent ages searching the web, can't find an answer.

I have a small home network, my Linux box and a Win XP box. Some of the shared folders have spaces, some do not e.g.:
//XPComputer/Myfolder
//XPComputer/My folder

From the Linux box I can see the shared folders on the Win box in several ways:
- I can use smbclient (with spaces, use "" around folder name)
- I can use smbmount (with spaces, use \ before space)
- I can use mount (in fstab, use \040 in place of space)
- I can use autofs, as long as the folder name has no spaces

Example of fstab, with spaces, that works with mount:
Code:

//XPComputer/My\040folder  /mnt/xpmyfolder  smbfs  noauto,user,guest 0  0
Example of map file, that works with autofs, without spaces
Code:

xpmyfold        -fstype=smbfs,username=guest,guest  ://XPComputer/Myfolder
But 'My folder' does not work in the last example.
I have tried:
- plain spaces
- Double quotes around the folder name
- Single quotes around the folder name
- Escaping the spaces i.e. \ then a space
- \040
In these cases there is a pause indicating that automounter is trying to do it's stuff, then it comes back with No such file or directory, which seems to be its generic error message.

If I do worse things, then it fails faster e.g. putting double quotes around the whole string "//XPComputer/My folder" causes a fast failure, with the same error message. From this I infer that at least in the other cases it is parsing the line and getting some sort of folder name (probably 'My'?).

Any ideas what I should do?

maxut 04-21-2004 08:32 AM

try:
mount -t smbfs //xpcomputer/My\ folder /mnt/xpmyfolder

chasn 04-21-2004 09:19 AM

Quote:

Originally posted by maxut
try:
mount -t smbfs //xpcomputer/My\ folder /mnt/xpmyfolder

No, I can manually 'mount' OK, I have an fstab entry so I don't need the options on the mount command, but if I do, then I can use double quotes around the folder name (I'm sure escaping the space, as you suggest, would also work).

The problem is getting it to automount, which is a problem with spaces in the map file (in this example auto.myfolder) - and as I said in the post, I've tried escaping the space and that doesn't work.

calande 07-04-2006 07:52 AM

Same problem here. Any idea?
Thanks,

c_verbiest 09-27-2011 09:45 AM

Use \ to quote the space
 
I hit this page having the same question unfortunately there was no answer here. After a lot of trial and error I found the solution.

You need to quote the space by adding a \ in front of it.
Simple really, it's a pity that it's different from /etc/fstab where you use \040 to represent a space.

On RedHat you can turn on debug logging to see what automount makes of your config by changing the LOGGING setting in /etc/sysconfig/autofs and a restart of autofs.

Look for a line like
Code:

automount[19389]: parse_mount: parse(sun): dequote("://hostname/a\ share\ name") -> ://hostname/a share name
in /var/log/messages

Looking back at the thread maxut already mentions this with a mount command


All times are GMT -5. The time now is 09:14 AM.