Autofs: Difference between revisions
From Lolly's Wiki
Jump to navigationJump to search
m (Text replacement - "[[Kategorie:" to "[[Category:") |
m (Text replacement - "</source" to "</syntaxhighlight") |
||
Line 9: | Line 9: | ||
# | # | ||
+dir:/etc/auto.master.d | +dir:/etc/auto.master.d | ||
</ | </syntaxhighlight> | ||
===/etc/auto.master.d/home.autofs=== | ===/etc/auto.master.d/home.autofs=== | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
/home /etc/auto.master.d/home.map | /home /etc/auto.master.d/home.map | ||
</ | </syntaxhighlight> | ||
===/etc/auto.master.d/home.map=== | ===/etc/auto.master.d/home.map=== | ||
Mount homes from different locations. | Mount homes from different locations. | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
* :/data/home/& nfs.server.de:/home/& | * :/data/home/& nfs.server.de:/home/& | ||
</ | </syntaxhighlight> | ||
or from a server that supports NFSv4.1: | or from a server that supports NFSv4.1: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
* -proto=tcp,vers=4.1 nfs.server.de:/home/& | * -proto=tcp,vers=4.1 nfs.server.de:/home/& | ||
</ | </syntaxhighlight> | ||
The asterisk marks any dir in /home/* should be matched by this rule. | The asterisk marks any dir in /home/* should be matched by this rule. | ||
Line 31: | Line 31: | ||
# mount -v | grep /home/a | # mount -v | grep /home/a | ||
/data/home/a on /home/a type none (rw,bind) | /data/home/a on /home/a type none (rw,bind) | ||
</ | </syntaxhighlight> | ||
For another /home/b which is on the nfs server it looks like this: | For another /home/b which is on the nfs server it looks like this: | ||
Line 38: | Line 38: | ||
# mount -v | grep /home/b | # mount -v | grep /home/b | ||
nfs.server.de:/home/b on /home/b type nfs (rw,addr=172.16.17.24) | nfs.server.de:/home/b on /home/b type nfs (rw,addr=172.16.17.24) | ||
</ | </syntaxhighlight> | ||
===cifs=== | ===cifs=== | ||
Line 44: | Line 44: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
/data/cifs /etc/auto.master.d/mycifsshare.map | /data/cifs /etc/auto.master.d/mycifsshare.map | ||
</ | </syntaxhighlight> | ||
<i>/etc/auto.master.d/mycifsshare.map</i>: | <i>/etc/auto.master.d/mycifsshare.map</i>: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
mycifsshare -fstype=cifs,rw,credentials=/etc/samba/mycifsshare_credentials,uid=<myuser>,forceuid ://192.168.1.2/mycifsshare | mycifsshare -fstype=cifs,rw,credentials=/etc/samba/mycifsshare_credentials,uid=<myuser>,forceuid ://192.168.1.2/mycifsshare | ||
</ | </syntaxhighlight> |
Latest revision as of 04:50, 26 November 2021
Automount home directories
/etc/auto.master
#
# Include /etc/auto.master.d/*.autofs
#
+dir:/etc/auto.master.d
/etc/auto.master.d/home.autofs
/home /etc/auto.master.d/home.map
/etc/auto.master.d/home.map
Mount homes from different locations.
* :/data/home/& nfs.server.de:/home/&
or from a server that supports NFSv4.1:
* -proto=tcp,vers=4.1 nfs.server.de:/home/&
The asterisk marks any dir in /home/* should be matched by this rule. The ampers and is replaced by the part which was matched by *. So if you enter /home/a the automounter searches local for /data/home/a which will be mounted when found.
# cd /home/a
# mount -v | grep /home/a
/data/home/a on /home/a type none (rw,bind)
For another /home/b which is on the nfs server it looks like this:
# cd /home/b
# mount -v | grep /home/b
nfs.server.de:/home/b on /home/b type nfs (rw,addr=172.16.17.24)
cifs
/etc/auto.master.d/mycifsshare.autofs:
/data/cifs /etc/auto.master.d/mycifsshare.map
/etc/auto.master.d/mycifsshare.map:
mycifsshare -fstype=cifs,rw,credentials=/etc/samba/mycifsshare_credentials,uid=<myuser>,forceuid ://192.168.1.2/mycifsshare