Interview Prep/Linux/Users, groups and access control

You need to rename a user from `jsmith` to `john.smith` on a server without breaking their files. How?

IntermediateScenarioUsers, groups and access control
Answer

Situation read → Change login name and home path, keep UID.

What I'd do →

  1. Make sure they are logged out: pkill -u jsmith.
  2. Run:
sudo usermod -l john.smith -d /home/john.smith -m jsmith
sudo groupmod -n john.smith jsmith
  1. Check crontabs (/var/spool/cron/jsmith is renamed by some distros, not all), sudoers entries and any config referencing the old name.

Why → Files are owned by UID, not name, so keeping the UID means ownership stays correct.

Interview tip → Mention that NFS-shared homes need the same change on every host or the UID mapping breaks.

All Linux questions Roadmap: Linux

More on Users, groups and access control