Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a Centos 5.7 box authenticating against Active Directory through PBIS Open (the new LikeWise Open), which works well. Now, I'm trying to get the server to automount the user's AD home directory, located at //ad.server.dom/shares/home directories (Yeah, it's a space in the path. I didn't set this up). Each user has a directory in there with the same name as the user.

I've tried to get pam_mount working, but it has a series of issues on RedHat and friends, and I can't seem to get that working. The directory does need to be automounted for the server to perform it's role. My reading on automount seems to suggest that there's no way to get it to do it's thing with authentication, though I'm happy to be proved wrong. I've looked at this resource, but it requires version RedHat (thus CentOS) 6 or higher, and newer packages than I have.

I can manually (As root) mount the AD directory using the command

mount.cifs "//ad.server.dom/Shares/home directories/testuser" /home/local/AD/testuser/nfs_mount/ -o username=testuser

and when I log in as testuser, I can see all of the sample files in the nfs_share directory.

Any tips towards the right direction would be highly appreciated. This is going to be on a server at a college, so it needs to be fairly stable, and would lead towards more Linux adoption there.

share|improve this question

If pam_mount and autofs aren't working for you you can try pam_exec with a bash script. It's hacky but it could work for you, see if you can fit the below to your needs:

Add to pam.d/system-config-auth:

auth   sufficient expose_authtok /usr/local/bin/mount_home

session optional /usr/local/bin/mount_home

Create a file /usr/local/bin/mount_home:


case "$PAM_TYPE" in
      auth )
         head -c -1 | mount.cifs "//ad.server.dom/Shares/home directories/$PAM_USER" /home/local/AD/$PAM_USER/nfs_mount/ -o username=$PAM_USER
      close_session )
         umount /home/local/AD/$PAM_USER/nfs_mount
exit 0

I haven't tested this but maybe you can make this work for you. Good luck!

share|improve this answer
Did this work? It has a +1 – sgtbeano Oct 13 '14 at 17:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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