Using samba with autofs on Fedora 9
Mount a samba share on the fly without having it mounted statically at boot via the /etc/fstab
file can bring you the advantage of a painless boot in case of unavailability of the samba server like in the following common scenarios:
- laptop: you mount your pc share at home, but when you move it becomes unavailable;
- workstation: you mount the share of your workmate but when he/she goes on holiday so his/her workstation is off.
Using autofs this can be accomplished easily following these steps:
-
Set
/auto
under the control of autofs adding this line to/etc/auto.master
:/auto /etc/auto.auto --timeout=5 --ghost
-
Point
directory
to a samba share//server/share
in/etc/auto.auto
:directory -fstype=cifs,credentials=/etc/smb.auth ://server/share
Note that directory is a child directory of /auto.
-
Store access credentials to the samba share in
/etc/smb.auth
:username=yourusername password=youpassword
-
Secure the password file:
# chmod 600 /etc/smb.auth
-
Start autofs:
# /etc/init.d/autofs start` Starting automount: [ OK ]