I want to enable pam_mkhomedir.so for users who authenticate to our system. I want a user's home directory to be created when they SSH into the box.

One common convention seems to be to put pam_mkhomedir.so into /etc/pam.d/sshd .

However, could pam_mkhomedir.so actually be placed into /etc/pam.d/login , so that home directories are upon login?

Pretend that I want the home directory to be created when a user logs into the box using sftp, telnet, or another method.


It seems like you have correctly stated the two options. You can put any given PAM module in a service-specific configuration (like /etc/pam.d/sshd) or in a common location where it will be used by multiple services.

Which choice you make depends entirely on your local requirements. Maybe you only want to auto-provision home directories if someone successfully logs in via ssh, but otherwise treat missing home directories as missing (so someone cannot log in via telnet or ftp until they first successfully connect with ssh).

...and of course if ssh is the only mechanism by which people can log in to your system, it doesn't really matter.

That said, I would probably place pam_mkhomedir in a common location.

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.