Automounting Windows samba share with autofs - dollar sign and SELinux woes

The target directory for my (well, the one I got from DokuWiki's wiki vOv) DokuWiki backup script is on a Windows fileserver. I did some searching and the best way to access this share seemed to be using autofs to mount the share only when the local directory it is mapped to is accessed. This way there is no worry that the file server is down when the Linux server boots and tries to mount the network share - which would require manual intervention to resolve (or testing that the share is available in the script). Instead, each time the script is run the share is mounted; and if it does fail for whatever reason hopefully the issue will be fixed for the next execution.

To set up autofs I used the information at this CentOS wiki page. Initially I went with the "Basic Method" because I couldn't get autofs to work. I later found out that autofs was failing because the share name I was trying to connect to had a dollar sign, which I wasn't escaping.

After reading the autofs errors in the system log, I caught on to the fact autofs wasn't even able to find the share, which made me think about having to escape the dollar sign. A few searches later confirmed it, so I tried putting a backslash infront of the dollar sign, which worked. In a way.

Autofs was now spitting out another type of error. SELinux was denying access -like it  always does >:(- to the filesystem or something. Searching the internet didn't provide me with a conclusive solution (I have no idea how SELinux actually works and it seems like a very broad topic). I decided to just disable SELinux at the start of the backup script, and reenable it at the end. Can't get much more jerry rigged than that can you?

About johnny

Computers have interested me since I can remember and conveniently I studied computer science. I also enjoy performing in a local amateur theatre group and cycling. This is where I post solutions to problems I've had in the office or any other project, hopefully clearly enough to refer back to in the future.
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>