I am having issues getting autofs to mount user's home directories via NFS. I have an NFS client (client.home) and an NFS server (server.home). Both systems are CentOS 7.4. SELinux is running in permissive mode on both systems. Can anyone point me into the right direction so I can automount user's home directories?
NFS Export Table on server
[root@server ~]# exportfs -v /home/tim client.home(rw,sync,wdelay,hide,no_subtree_check,sec=sys,secure,root_squash,no_all_squash)
The client can see these exports
[root@client ~]# showmount -e server Export list for server: /home/tim client.home
There are two users. One on the client, and one on the server. They both have the same name and UID. However, the user's home directory is only located on
[tim@server ~]$ id uid=1001(tim) gid=1001(tim) groups=1001(tim) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 -bash-4.2$ hostname client.home -bash-4.2$ id uid=1001(tim) gid=1001(tim) groups=1001(tim) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
This directory should automount for user
client.home. Unfortunately, that does not seem to happen.
[root@client ~]# su - tim -bash-4.2$ id uid=1001(tim) gid=1001(tim) groups=1001(tim) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 -bash-4.2$ cd /home/tim -bash: cd: /home/tim: No such file or directory -bash-4.2$ ls /home vagrant
Even though, I believe I have set up my
auto.master file correctly.
[root@client ~]# cat /etc/auto.master # # Sample auto.master file # This is a 'master' automounter map and it has the following format: # mount-point [map-type[,format]:]map [options] # For details of the format look at auto.master(5). # /misc /etc/auto.misc # # NOTE: mounts done from a hosts map will be mounted with the # "nosuid" and "nodev" options unless the "suid" and "dev" # options are explicitly given. # /net -hosts # # Include /etc/auto.master.d/*.autofs # The included files must conform to the format of this file. # +dir:/etc/auto.master.d # # Include central master map if it can be found using # nsswitch sources. # # Note that if there are entries for /net or /misc (as # above) in the included master map any keys that are the # same will not be seen as the first read key seen takes # precedence. # +auto.master /home /etc/auto.home
And the contents of my
[root@client /]# cat /etc/auto.home * nfs4,rw &:/home/&
I would expect that I should be able to simply
cd into the user's home directory. Instead, when
autofs.service is running, I can't even create any files in
[root@client /]# systemctl is-active autofs active [root@client /]# touch /home/test touch: cannot touch ‘/home/test’: Permission denied [root@client home]# ll -d /home drwxr-xr-x. 2 root root 0 Sep 16 02:04 /home [root@client /]# systemctl stop autofs [root@client /]# systemctl is-active autofs inactive [root@client /]# touch /home/test [root@client /]# ls /home test vagrant
I can manually mount the NFS shares. Also, I am pretty sure the strange permissions issues from before were due to the
root_squash option I had set in the
[root@client ~]# mount -t nfs4 -o rw server.home:/home/tim /mnt [root@client ~]# df -t nfs4 Filesystem 1K-blocks Used Available Use% Mounted on server.home:/home/tim 39269760 1192448 38077312 4% /mnt [root@client ~]# ll -d /mnt drwx------. 2 tim tim 86 Sep 16 18:51 /mnt