In this video, I will show you how to set up AutoFS for home directories.
So AutoFS is a common option for home directory access.
In this scenario, an NFS server is providing access to home directories, and the home directory
is auto-mounted by a user while logging in.
And that means that the user can log in on all systems where AutoFS is running and will
always have access to the NFS-provided home directory, and that's convenient.
Now if you want to support different directory names in one auto-mount line, you need to
use wildcards.
And that looks like star minus rw nfs-server-colon-slash-home-slash-ldap-slash-npercent, meaning that you are going to point
to something in your auto.master, let's say home-slash-ldap.
And if in home-slash-ldap star, that is anything is accessed, then it's mounted as nfs-server-colon-slash-home-slash-ldap-slash-npercent, where npercent is matching star.
Let me show you.
So starting again with etc-auto.master, in auto-mount, you always start with etc-auto.master.
And this time, I'm going for slash-home-slash-ldap.
And in slash-home-slash-ldap, well, we are going to first specify an etc-auto.ldap.
That's step one.
Step two, we create an etc-auto.ldap.
And in etc-auto.ldap, I'm using star minus rw nfs-server-colon-slash-home-slash-ldap-slash-npercent.
And that's all.
Don't forget to restart AutoFS.
Next, let's check out the home LDAP directory.
As you can see, nothing.
But if I go to LDAP user whatever, you can see that LDAP user whatever is auto-mounted anyway.
And what about LDAP user something else?
Well, that is also auto-mounted.
And mount is showing all of that.
So here, we have the auto.ldap, which is telling which file AutoFS should be using.
And here, we have the mounts that are currently active.
After a certain period of inactivity, the mount will also automatically disappear.