Automounter With Users Home Directories On CentOS 7.

Home » CentOS » Automounter With Users Home Directories On CentOS 7.
CentOS 9 Comments

Has anyone gotten this to work? Im studing for my rhce and was trying to get this to work and its just not working like it shows in the book im going by. So basically I have two CentOS 7 servers running under kvm.. One is the nfs server, one is the nfs client.. I have been mounting up other NFS
shares on the client and they work fine.. The automounter also seems to mount direct mounts fine as well.. But when I try to do home directories, it just doesnt work.. on my server (named server1), Im exporting /home as
/home server2(rw,sync,no_root_squash)

on my client, ive got
[root@server2 ~]# grep home /etc/auto.master
/home /etc/auto.home –timeout0
and
[root@server2 ~]# cat /etc/auto.home
* -rw,soft,intr server1:/home/&
[root@server2 ~]#

and on server1, ive got the selinux enabled, but have the following booleans set.
[root@server1 ~]# getsebool -a | grep nfs_
nfs_export_all_ro –> on nfs_export_all_rw –> on use_nfs_home_dirs –> on
[root@server1 ~]#

so when I try to switch to my user on server2 (client), I get
[root@server2 ~]# su – user1
Last login: Wed Sep 9 16:25:27 EDT 2015 on pts/0
su: warning: cannot change directory to /home/user1: No such file or directory
-bash-4.2$

and theres nothing in the logs that I can find as to why the automount
isnt working..
[root@server2 ~]# showmount -e server1
Export list for server1:
/home server2

I generated a log (on both server) with sealert, but it shows found 0 alerts in /var/log/audit/audit.log

any ideas?

9 thoughts on - Automounter With Users Home Directories On CentOS 7.

  • Not tried automount with CentOS 7 nor with selinux.

    With that said autofs relies on nfs mounting to work, so have you started there by attempting to manually mount /home?

    Another place to look is at the hostname. I’ve had problems where auto mount doesn’t like the short name and insists on using a FQDN, to get around that you could try using the IP address rather than the hostname.

  • [root@server2 home]# mount server1:/home/jason /home/jason
    [root@server2 home]#
    [root@server2 home]# ls /home/jason/
    Desktop Documents Downloads Music mylogfile.txt Pictures Public
    Templates Videos
    [root@server2 home]# df -h /home/jason/
    Filesystem Size Used Avail Use% Mounted on server1:/home/jason 297M 19M 278M 7% /home/jason
    [root@server2 home]#

    so it works manually, just not with the automounter.

    Jason

  • Correct nfs is working and there aren’t any firewall issues.

    The problem is probably related to the way and steps that automountd takes to perform the mount, which is probably related to the fact that
    /home exists. The quickest way to figure that out is to mv /home to /home- and then try automountd again. When and autofs file system is access automountd will check that the mount point exists and create it if not and then perform the mount.

    In all this you might have to restart autofs on the client.

    Pete

  • autofs works just fine with an existing directory. It worked fine in EL4/5/6/7.

    Indeed the default config has /misc managed by automount, and that directory exists.

    No?

    I use krb5 NFS with EL7 just fine on /home with autofs.

    jh

  • ok, I have moved home out of the way and restarted automounter.. and now I see the /home directory appear when autofs is started, but there is still nothing there..

    [root@server2 home]# cd /home
    [root@server2 home]# ls
    [root@server2 home]# cd jason
    -bash: cd: jason: No such file or directory
    [root@server2 home]# df -h ./
    Filesystem Size Used Avail Use% Mounted on
    /etc/auto.home 0 0 0 – /home
    [root@server2 home]#

    I still dont see any errors in the logs on either server.

    btw, my uid on both servers is the same.
    [root@server2 ~]# id jason uid00(jason) gid00(jason) groups00(jason),10(wheel)

    [root@server1 log]# id jason uid00(jason) gid00(jason) groups00(jason),10(wheel)

    Jason

  • Does “automount -m” show what you expect?

    When in doubt, enable DEBUG logging in /etc/sysconfig/autofs, as it’s very verbose about what it’s doing if only you ask.

    jh

  • AHA!! now I think we are getting somewhere! ;)

    Mount point: /home

    source(s):

    instance type(s): program
    map: /etc/auto.home

    no keys found in map <----- bing bing bing!! I believe this means it doesnt like whats in my /etc/auto.home? soooo whats wrong with: [root@server2 etc]# cat /etc/auto.home * -rw,soft,intr 192.168.0.110:/home/& [root@server2 etc]# ive tried it with tabs and with spaces with the host name, with the ip address.. in the logs, I see Sep 11 09:41:00 server2 automount[3609]: expire_proc: exp_proc 140717501646592 path /home Sep 11 09:41:00 server2 automount[3609]: st_expire: state 1 path /- Sep 11 09:41:00 server2 automount[3609]: expire_proc: exp_proc 140717424346880 path /- Sep 11 09:41:00 server2 automount[3609]: expire_cleanup: got thid 140717501646592 path /home stat 0 Sep 11 09:41:00 server2 automount[3609]: expire_cleanup: sigchld: exp 140717501646592 finished, switching from 2 to 1 Sep 11 09:41:00 server2 automount[3609]: st_ready: st_ready(): state = 2 path /home Sep 11 09:41:00 server2 automount[3609]: expire_cleanup: got thid 140717424346880 path /- stat 0 Sep 11 09:41:00 server2 automount[3609]: expire_cleanup: sigchld: exp 140717424346880 finished, switching from 2 to 1 Sep 11 09:41:00 server2 automount[3609]: st_ready: st_ready(): state = 2 path /- Sep 11 09:41:01 server2 automount[3609]: handle_packet: type = 3 Sep 11 09:41:01 server2 automount[3609]: handle_packet_missing_indirect: token 76, name jason, request pid 3752 Sep 11 09:41:01 server2 automount[3609]: attempting to mount entry /home/jason Sep 11 09:41:01 server2 automount[3609]: lookup_mount: lookup(program): looking up jason Sep 11 09:41:01 server2 automount[3609]: lookup(program): lookup for jason failed regards, Jason