Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I want to automount a samba/cifs share that has a lethal special character in it. Does somebody know how to escape it properly? //host/special&char/mp /mnt/mp/ smbfs credentials=/etc/samba/cred-file,uid=nobody,gid=somebody,file_mode=066,dir_mod e=077 0 ...
  1. #1
    Linux Enthusiast Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    718

    [SOLVED] fstab and special characters

    Hi,

    I want to automount a samba/cifs share that has a lethal special character in it. Does somebody know how to escape it properly?

    //host/special&char/mp /mnt/mp/ smbfs credentials=/etc/samba/cred-file,uid=nobody,gid=somebody,file_mode=066,dir_mod e=077 0 0
    I tried out:

    1. \& (this kind of escape works fine for spaces, but not the ampersand)
    2. \046 (this kind of escape works fine for spaces too, but again not the ampersand)
    3. Escape the samba uri (//host/special&char/mp) with " and ', didn't work either


    It should somehow be possible, but I'm kind of too stupid to realize how.

  2. #2
    Just Joined!
    Join Date
    Mar 2005
    Location
    Sweden
    Posts
    47

  3. #3
    Linux Enthusiast Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    718
    Thanks for your feedback.

    Unfortunatly this article proposes only to force a charset for the file and directory informations. This is not the problem I've got here.

    My problem is caused by fstab (/etc/fstab) that does not accept mount lines that contain special characters like "&" (ampersand).

    Somehow fstab should be able to handle mount targets that contain characters like "&" (ampersand).

    BTW: I probably have found a workaround - which is to use autofs as there one has better control on the configuration files and thus more possibilities. But setting up autofs is a huge overhead for my rather small problem. That's why I refuse to configure it like that as long there could be another way.

    EDIT: Just posted to the ubuntu mailing-users mailing list (see here).
    Last edited by Kloschüssel; 02-25-2011 at 06:39 AM.

  4. #4
    Linux Enthusiast Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    718
    Resolved. *banging head* All worked out fine once I used the octal ascii representation of all special characters.

    SPACE = \040
    AMPERSAND = \046

    See Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion for a complete list.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...