Site icon New Generation Enterprise Linux

Stop new users from logging in before their home directory is ready

User & Group Management

Stop new users from logging in before their home directory is ready

🧩 The Challenge

Setting up a new user via useradd usually creates their home folder, but if you’re pulling users from LDAP or AD, the directory often doesn’t exist until the first login. This leaves folks staring at a blank screen or getting dumped into the root directory which is just asking for a support ticket.

💡 The Fix

You can force the system to create the home directory on the fly when they first authenticate using the PAM mkhomedir module. This saves you from running manual mkdir and chown commands for every new hire.

pam-auth-update --enable mkhomedir

⚙️ Why It Works

Adding this module to the PAM stack hooks into the login process so the system checks if a home directory exists and creates one from /etc/skel if it’s missing. It’s a clean way to automate a step that otherwise gets forgotten until someone complains.

🚀 Pro-Tip: Check /etc/security/pam_mkhomedir.conf to make sure the umask is set to 0077 so your users don’t accidentally leave their config files world-readable.

Linux Tips & Tricks | © ngelinux.com | 8/11/2026

0 0 votes
Article Rating
Exit mobile version