Hi,
today I will explain how to easy it is to automatically mount a windows share on linux.
The following packages are necessary: autofs, cifs/samba client tools
In this example I use a debian linux system.
root@dev # apt-get install autofs cifs-utils
edit the auto.master file with your favorite editor:
root@dev # vi /etc/auto.master
add the following line
/media/cifs /etc/auto.cifs --ghost
/media/cifs
– is the root directory where the mount points are created (this is not the mount point itself!), the directory must exist.
/etc/auto.cifs
– the definition file of the mount points
--ghost
This option will create the mount point permanently, even the share isn’t mounted (there are doubledashes before ghost:-))
Create a new file /etc/auto.cifs and add your share definition. In this example the Windows computer is mediaserver with the share multimedia$ (Note: you have to quote the $ character in auto.cifs file or you got cifs_mount failed w/return code = -6). The share should be mounted as user michl which has UID 1000 and GID 1000. Insert the following line to /etc/auto.cifs:
root@dev # touch /etc/auto.cifs
root@dev # vi /etc/auto.cifs
Continue reading Linux: Automount Windows or Samba shares →