>_ IzzyLab

Topic breakdown

Locking a user without deleting them is the standard scenario for departed employees: we close off access but keep the account and files. You need to close two entry paths. The password is stored as a hash in /etc/shadow, and usermod has a lock option that prepends a ! to the front of the hash so that no entered password will match. The second lock is the login shell from /etc/passwd: replacing it with a dummy like /usr/sbin/nologin or /bin/false cuts off interactive login. Neither operation touches the home directory.

What's checked

  1. contractor shell is disabled (nologin/false)
  2. contractor password is locked
  3. contractor home directory preserved

What it looks like