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 labsvcinspect the shell field -
id labsvcinspect UID and groups -
type -a nologinlocate the installed program -
/usr/sbin/nologinobserve 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.