>_ IzzyLab

Hands-on task

This task is step 19 of the course “Users, groups and permissions”

Revoke a contractor's access

easy~3 min

The contract with an external engineer has ended. His account ext_mike must be closed: password login is forbidden, and the login shell is a stub (nologin or false). Don't delete the account itself or the home directory — his scripts are still there and will be sorted out later.

What you'll practise:
  • usermod -L
  • nologin
  • /etc/shadow
  • /etc/passwd
  • locking an account

Topic breakdown

A departing employee or contractor is usually not deleted but locked: access is closed while the files and history remain. Two paths have to be closed. The password lives as a hash in /etc/shadow, and the lock option of usermod prepends a ! to the hash — after that no password typed in will ever match, and unlocking restores the old one. The second lock is the login shell in /etc/passwd: a stub like /usr/sbin/nologin ends the session immediately. Neither touches the home directory.

What's checked

  1. ext_mike's password is locked
  2. login shell is nologin/false
  3. account and files kept

What it looks like