Automount

From frogzie
Jump to navigation Jump to search

1 AIM

Centralised users directories

Shared users directories physically on cyber8:/home/export, auto-mounted on cyber7:/home/export

  • cyber8: ThinkPad X230 set up with CentOS 8.1
  • cyber7: ThinkPad X230 set up with CentOS 7.8

2 NFS Setup

2.1 cyber8 NFS Server

Perform the following instructions on cyber8

  • Firewall
    • firewall-cmd --permanent --add-service=nfs
    • firewall-cmd --permanent --add-service=rpc-bind
    • firewall-cmd --permanent --add-service=mountd
    • firewall-cmd --reload
  • NFS server
    • dnf install nfs-utils
    • systemctl enable nfs-server.service
    • systemctl start nfs-server.service
  • Export shared users directories
    • mkdir /home/export
    • Add following line to /etc/exports
       /home/export 192.168.0.0/24(no_all_squash,no_root_squash,async,secure,no_subtree_check,rw) 
    • exportfs -a
  • showmount -e   (check the setup)
    Export list for cyber8.rshome.lan:
    /home/export 192.168.0.0/24

2.2 cyber7 NFS Client

Perform the following instructions on cyber7

  • dnf install nfs-utils
  • showmount -e cyber8   (check the setup)
    Export list for cyber8:
    /home/export 192.168.0.0/24

3 cyber7 Automount Setup

Perform the following instructions on cyber7

  • yum install autofs
  • Auto-mount any cyber8:/home/export subdirectories
    • Create /etc/auto.usersdir with the following content
       *	cyber8:/home/export/& 
    • Create /etc/auto.master.d/usersdir.autofs with the following content
       /home/export	/etc/auto.usersdir 
  • systemctl enable autofs
  • systemctl restart autofs