Automatically creating home directories at login time

One of the initial problems I’ve found after setting up LDAP or some other centralised user information and authentication system, is that unless there’s shared storage mounted on all the servers, you need to manually create home directories for users.

Fortunately there’s a nice PAM module that ships with Linux PAM, called pam_mkhomedir which will automatically create a home directory for a user upon login if one doesn’t already exist, basing it off the standard contents of /etc/skel/

The full information can be found in the man page at

However it’s even easier for RHEL/CentOS/Fedora users, who can use the ever handy authconfig tool to adjust the PAM configuration with a single CLI command:

# authconfig --enablemkhomedir --update

Leave a Reply