autofs: Mount under user home directory
Hello,
I setup autofs with kerberos (https://access.redhat.com/solutions/276503), which works great. But I'm having an additional requirement:
Is there a way to make the destination folder in /etc/auto.master "dynamic" by variables?
I want that the destination folder is under each users home. Something like the following in /etc/auto.master:
~/server /etc/auto.cifs
or
&/server /etc/auto.cifs
But these both don't work.
Does someone have an idea?
Regards,
Responses
Can you post the contents (or sanitised contents) of your auto.cifs file?
From memory, the ampersand can be used for key substitution on the right hand side, but the key needs to be defined on the left. In your examples above you are using key substitution on the left.
So the desired result is to mount a directory down from the user's home directory dynamic portion?
eg.
/home/<username>/server
Which version of RHEL are you using?
So the user home directories, eg:
/home/a
/home/b
Already exist locally on the server, these don't need to be mounted? But the 'server' directory doesn't exist in each '/home/x' directory?
So you are attempting to mount 2 levels at once under the users home directory?
ie. 'server/home'
The only way I can think you would be able to achieve that with automount is to make an automount entry for each user (perhaps on useradd?)... unless someone else can suggest an alternative? (can't find anything specific in autmount documentation)
You could also create the 'server/home' directory on the fileserver for each user and then mount the user home directory as a normal automount (not multiple levels).
eg. /home/a (a is the autmount), when mounted the user's directory contains 'server/home'
Is the issue that users have local home directory contents on each server that you want to keep? and that is why you want to mount a level down?
It may help if you provide a description of the issue you are attempting to solve (with constraints) and others may be able to provide alternate methods that will work for you.
The only 'variable' I'm aware of that works on the key side (left side) of an automount map is *.
If you set up the auto.master as:
/home/*/server /etc/auto.cifs
That may work to call the auto.cifs indirect map for the home CIFS mount. I don't recall if auto.master is considered a direct or indirect map though.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
