Automatically create local home directory when logging in with FreeIPA

Kovasky Buezo | Jun 7, 2023 min read

edited on: May 17, 2024

Intro

While setting up my hosts with FreeIPA, I noticed that home directories were not being created when logging in through ssh. Looking online it seems that most people just use NFS shares to keep home directories the same across devices but I did not want to set up NFS home shares. Fixing this in RHEL-based distros is easy with authconfig but debian-based distros do not come with this. To fix this in debian-based distros is as easy as modiyfing the pam.d config file.

Modify sshd and reload pam

Open /etc/pam.d/sshd with your favourite text editor and add the following line:

session required pam_mkhomedir.so skel=/etc/skel/ umask=0022

After this, no reload should be necessary but just in case we execute the following command:

sudo pam-auth-update --force --package

Done!

After following these steps, our host should automatically create a home directory when logging in through ssh using FreeIPA credentials.