Interview Prep/Linux/SSH, sudo and authentication

Logins over SSH succeed, but the user lands in `/` with `Could not chdir to home directory /home/bob: No such file or directory`.

BeginnerTroubleshootingSSH, sudo and authentication
Answer

Likely causes → The home directory wasn't created (user added without -m, or a directory-service user with no mkhomedir), or an NFS/autofs home share isn't mounted.

Diagnose →

getent passwd bob
ls -ld /home/bob
findmnt /home

Fix → Create it: sudo mkhomedir_helper bob or install -d -m 700 -o bob -g bob /home/bob. For directory users, enable pam_mkhomedir (authselect enable-feature with-mkhomedir, plus oddjobd).

Prevent → Use useradd -m, or enable mkhomedir for central accounts.

All Linux questions Roadmap: Linux

More on SSH, sudo and authentication