Change Default Home Directory with LDAP and Automount
I have a number of machines that are set up with LDAP Authentication. The LDAP also stores the path to the user's home directory. That user home directory is actually on an NFS server. So the path stored in LDAP for user bubba is: /homedirs/bubba. I use automount to mount each user's home when they log in. That part works great. So the user logs in via LDAP, gets their NFS home mounted, and all is good.
However, we have a second set of machines that need to be set up in the same way. This second set of machines will need a different set of preferences. IE - must use a different home directory. This will use the same NFS server space for the home dir. I tried to just change the mount point via automount to /homedirs/bubba/unix01. But, couldnt log in, because unix01 dir did not exist. This is where I am having a heck of a time. Ultimately, I'd like to have a different home dir for each set of machines like: /homedirs/bubba/unix01, /homedirs/bubba/unix02. And that unixXX directory be made if it doesnt exist, upon the user logging in.
I could just do a bash script somewhere that would "If not exist /homedirs/$USER/unix01, mkdir /homedirs/$USER/unix01". But not sure where to put it. Anything in .profile, .bashrc, would be too late.
The options of manipulating the LDAP server itself, or of just creating those dirs on the NFS server are out. (There are 10s of thousands of users.. and the NFS server is controlled by another entity)
Any thoughts on this would be much appreciated. Or perhaps a different take on how to solve this. My mind is spinning! :)
(Hope I explained this clearly enough)
halo greslore, you say that you are succesfull to mount each user's home directory when they log in, do you configure on the client side or just let ldap do automatically for you? i'm having a trouble using automount with ldap now, could you kindly tell me how to configure it?
To get autofs working, here is what I did:
1) apt-get install autofs
2) vi /etc/auto.master
My auto.master file:
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#/misc /etc/auto.misc --timeout=60
/auto /etc/auto.auto --timeout=60
/homedirs /etc/auto.homedirs --timeout=60
3) vi /etc/auto.homedirs
My auto.homedirs file:
( There is a tab between the * and the servername, and the '&' above tells autofs to use the currently logged in user as part of pathname )
And this enabled me to use autofs. No matter which machine a user logs into, they will have the same network home. Keep in mind that this will use the home that you have set up in your LDAP setting for the user logging in. In my case the home on the LDAP server is set to /homedirs/username
Oh, and this is using Ubuntu linux 6.06 by the way. So you may need to install autofs via your distro specifics.
Did you ever resolve this issue? I would love to hear how!
|All times are GMT -5. The time now is 10:06 PM.|