/etc/fstab refuses to accept "&" (ampersand)

Dominik Psenner dpsenner at gmail.com
Fri Feb 25 07:39:25 UTC 2011


Hi,

I have a samba/cifs share that contains a special character (namely "&") and
fstab refuses to accept such a line even with multiple approaches to escape
it.

So here's what I've tried to accomplish so far (all examples below would be
invalid lines for /etc/fstab):

Plain ampersand doesn't work:
---quote1
//host/special&char/mp /mnt/mp/ cifs
credentials=/etc/samba/cred-file,uid=nobody,gid=somebody,file_mode=066,dir_m
od e=077 0 0
---quote1

First attempt was to escape it with a backslash:
---quote2
//host/special\&char/mp /mnt/mp/ cifs
credentials=/etc/samba/cred-file,uid=nobody,gid=somebody,file_mode=066,dir_m
od e=077 0 0
---quote2

On a second thought I escaped it with the ASCII equivalent octal number:
---quote3
//host/special\046char/mp /mnt/mp/ cifs
credentials=/etc/samba/cred-file,uid=nobody,gid=somebody,file_mode=066,dir_m
od e=077 0 0
---quote3

As third attempt I tried to escape the whole uri with either " or ':
---quote4
"//host/special\046char/mp" /mnt/mp/ cifs
credentials=/etc/samba/cred-file,uid=nobody,gid=somebody,file_mode=066,dir_m
od e=077 0 0
---quote4

All examples above fail too for the mount type "sambafs" (i.e.
's/cifs/sambafs/g').

Is it a bug? Is it a feature? I know there is a workaround using autofs, but
as far as I can tell, it should also work with fstab.

Help / discuss!

Greetings,
D.





More information about the ubuntu-users mailing list