It is a necessary evil at work that I have to get my laptop that runs Kubuntu to interact with the rest of the Windows systems at work.In order to show that Linux can hold its own I’ve not asked for any special changes to be made to the way the windows servers are set up. I just make Linux work with what the Windows PCs use.
The main area of interaction is the mounting of Samba shares to get at my network storage.
In general this is fine but I have found one little gotcha if you are using /etc/fstab to mount shares at boot up and the share names in question have spaces in them.
The problem is that spaces are delimiters in /etc/fstab and trying to avoid getting the space interpreted by usng quotes or backslashes won’t work with /etc/fstab.
So first here are two lines from an /etc/fstab for mounting two windows shares. The windows shares on a server called nas001 and the share names are “Backup” and “My Documents”
# /etc/fstab: static file system information.#
# <file system> <mount point> <type> <options> <dump> <pass>
//nas001/Backup /mnt/backup cifs credentials=/home/raetsel/creds 0 0
//nas001/My\040Documents /mnt/mydocs cifs credentials=/home/raetsel/creds 0 0
So after the comments the first line shows mounting a share without a space, the second line shows mounting a share with a space where space is replaced with \040
So what’s with \040? Well the and a three digit code is interpreted as an ASCII value of a character in octal (base 8).
In an Linux command shell type man ascii to see a list ofASCII codes and their octal, decimal and hexadecimal equivalents.
Space is decimal 32 which is octal 40 ( but we need 3 digits for the interpretation to work so it is 040)
In a similar vein \134 is the octal code for a \ backslash so if you want to have a domain username pair in the options of the line in fstab you could do it with username=mydomain\134raetsel