share /home with nfs automount

server

vi /etc/exports
/home 10.10.10..0/24(rw,sync)
systemctl restart nfs-server

client

mkdir -p /home/user
showmount -e 10.10.10.1
vi /etc/auto.master
/-  /etc/auto.home
/home  /etc/auto.home
vi /etc/auto.home
*  -fstype=nfs,rw  10.10.10.1:/home
systemctl start autofs
 systemctl enable autofs
firewall disabled

now i have three users, only one of them can login with his home dir
the others two login with "/"

Asked By: peter louis

||

You forgot to add the ampersand at the end of the above line to auto.home :

* -fstype=nfs,rw 10.10.10.1:/home/&

That’s what will be the referring of each user home directory on the server side.

Remove the following entry : /- /etc/auto.home

Also you don’t need to create /home/user directory ; because it will be available and mounted automatically for every user.

So this way users can access their shared NFS directories just by accessing /home/<username> on the client side.

Also make sure on the client side that home directories does not exist.

But It’s better to not use wildcards so it won’t mount all the remote home directories, instead you can put different entries in your home.auto:

<user1>    -fstype=nfs,rw 10.10.10.1:/home/<user1> 
<user2>    -fstype=nfs,rw 10.10.10.1:/home/<user2>
<user3>    -fstype=nfs,rw 10.10.10.1:/home/<user3>
Answered By: Reda Salih
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.