Where to start First steps track · 15 stages
Linux Labs

nologin — a shell that refuses login

cheat sheet · Ubuntu 24.04; Bash 5.2 for shell builtins https://lab.dimsanych.ru/en/wiki/nologin/

Cheat sheet

  • getent passwd labsvc inspect the shell field
  • id labsvc inspect UID and groups
  • type -a nologin locate the installed program
  • /usr/sbin/nologin observe refusal, without changing shell
  • printf '%s\n' "$?" immediately read its nonzero status

Options

The main use is setting the program's path in the user's shell field. The program itself has only --help and --version; every other invocation always ends in refusal. Verify the local path before changing an account; training examples use /usr/sbin/nologin.

Do not confuse the program with /etc/nologin and PAM-based login restrictions. These are different interfaces. Use man 8 nologin for documentation about the program specifically.

Loading…