Stop user logins from hanging when their home directory is a stale NFS mount

User & Group Management

Stop user logins from hanging when their home directory is a stale NFS mount

🧩 The Challenge

Dealing with users who can’t log in because their home directory is pointed at a dead or hung NFS share is a nightmare. You end up with a server full of zombie processes and an SSH session that just sits there mocking you while it waits for a timeout that never seems to come.

💡 The Fix

Just force the shell to boot them into a safe, local directory if their home mount isn’t responding. It keeps the login process moving so you can actually get in to fix the mount.

usermod -d /var/empty -s /usr/sbin/nologin problematic_user
# Or temporarily override the home directory in /etc/passwd if you need them to still access the system:
sed -i 's|/home/user|/tmp|g' /etc/passwd

⚙️ Why It Works

By remapping the user home directory to a local path, you prevent the PAM session modules from trying to mount or resolve a stalled network path. Once the shell hits a directory it can actually access, the login handshake completes immediately.

🚀 Pro-Tip: Always keep a root shell open on a local partition before you start messing with fstab or network mounts.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted