2

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?

Thanks

4

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 5.1.3.1. – Ben Oct 17 '17 at 7:14
0

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.master

/-                      /etc/auto.nfs --timeout=86400
+auto.master
+dir:/etc/auto.master.d

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 !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.