/etc/fstab refuses to accept "&" (ampersand)
Dominik Psenner
dpsenner at gmail.com
Fri Feb 25 08:00:09 UTC 2011
Problem solved.
All worked out fine once I used the octal ascii representation *_for all_*
special characters.
SPACE = \040
AMPERSAND = \046
See http://www.asciitable.com/ for a complete list.
> -----Original Message-----
> From: Dominik Psenner [mailto:dpsenner at gmail.com]
> Sent: Friday, February 25, 2011 8:39 AM
> To: 'ubuntu-users at lists.ubuntu.com'
> Subject: /etc/fstab refuses to accept "&" (ampersand)
>
> 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_mod 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_mod 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_mod 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_mod 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