11 Mar 2011

Autofs configuration

· autofs linux

Autofs configuration

Autofs uses /etc/autofs/auto.master as its default primary configuration file. We can define two kind of maps in this file, direct and indirect. An example:

# mount point   config file        options
/-              /etc/autofs/   --ghost
/media/cifs     /etc/autofs/auto.cifs     --timeout=60 --ghost
/media/sshfs    /etc/autofs/auto.sshfs    --timeout=60 --ghost

First map is a direct map, the other two are indirect. Entries in a direct map contain an absolute path, instead of the relative path names used in indirect maps. The --ghost option tells the automounter to create empty directories of all the mount points. The /media folder should be empty. Let's see the other configuration files, in this example we are going to mount a remote file system using cifs and ssh.


# directory          mount options                      device to mount
/home/ian/music      -fstype=cifs,ro,soft,user=guest    ://
/home/deb/music      -fstype=cifs,ro,soft,user=guest    ://

Folders /home/ian/music and /home/deb/music should be empty or not exist. In both we can access to te remote folder /music in computer


# directory      mount options                        device to mount
ian              -fstype=cifs,ro,soft,user=ian        ://
deb              -fstype=cifs,ro,soft,user=deb        ://

Folders /media/cifs/ian and /media/cifs/deb will be created.


# directory     mount options                                               device to mount
ian_ssh         -fstype=fuse,rw,allow_other,IdentityFile=/path/to/ssh_key   :sshfs\#user@\:/mnt/folder/

Folder /media/sshfs/ain_ssh will be created.

← Home