I have a NFS server exporting home directories for remote users and the workstations have local and remote users. I want to configure autofs to mount a remote user home directory as a subdirectory of /home directory.

I configured the autofs to mount the nfs shares, however when a remote share was mount the local home directories gone away.

Is there a way of mounting only the directories that does not exists in the /home directory? Is there a way that is not configured by setting by hand all the local folders, automatically discovering each existent directory and skipping the mount of it?



2 Answers 2


I just solved a similar issue. I wanted to mount a few users' /home/username directories from nfs, but have a couple others live on the local disk. Unfortunately, when trying to use the local disk directory, I was running into permissions errors.

After some research, I read man auto.master 5 a bit more carefully, and found this:

For direct maps the mount point is always specified as:
and the key used within the direct map is the full path to the 
mount point. The direct map may have multiple entries in the  master map.

So, in auto.master, you would have a line like:

/- auto.misc --timeout 60

In auto.misc:

/home/remoteuser <options> <nfsserver>:<path to home dir>

You can still have indirect mounts in the auto.misc file if you want. Just depends on how you want to organize your map files.

Note, this is on Ubuntu 16.04 and automount 5.1.1. I have not tested this on other OSes yet.

  • This also works on archlinux with autofs
    – Ben
    Oct 17, 2017 at 7:14
  • This is a solution for a single remote user, right? The OP talks about remote users in plural, however.
    – U. Windl
    Feb 6, 2023 at 8:23
  • I haven't mounted user directories in a long time, but if I recall correctly, I was mounting multiple users directories.
    – David R.
    Oct 27, 2023 at 18:45

After struggling a bit, glad to find this post, which is the clearer on the topic I've found.

Just to reformulate, and confirm it works under Centos 7|autofs-5.0.7-56.

Basic, with very few modifications on original files :


/-                      /etc/auto.nfs --timeout=86400

autofs.conf :

``nothing changed``

auto.nfs :

/home/users           -rw,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,intr,acl,noatime,nodiratime,sync storageVIP:/DATA/home/users

That's leading to have my local accounts/directories still accessible in /home, and [only] the /home/users fullfilled with the data from the NFS mounted point. It also gives the opportunity to granulary mount any other export in any subdirectory.

Thanks again guyz !

  • So you are mounting remote users at a different directory? How would that work without adjusting the users' home directories in /etc/passwd?
    – U. Windl
    Feb 6, 2023 at 8:27
  • Sorry, @U.Windl, it was quite a long time ago, I don't remember the specifics, nor can I access the server to check :/ My best guess would be that it was not about local system users, but a replication of [a web application] users from another server, autofs was just to have realtime sync for storage and have a failover capacity.
    – tisc0
    Aug 30, 2023 at 22:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .