During maintenance, reject interactive logins for non-root users.
Show users the reason for the rejection.
Which file is commonly used?
/etc/nologin blocks non-root logins on implementations that support it and can display the file content as an explanation.
Detailed explanation
~/.nologinIncorrect. A file under one user's home does not represent a system-wide block.
/etc/hostsIncorrect. /etc/hosts is a static name map.
/etc/nologinCorrect. /etc/nologin is the conventional maintenance lockout file.
/var/log/nologinIncorrect. /var/log is for logs, not the standard login-control file.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'maintenance in progress' > /tmp/pathpass-nologin; cat /tmp/pathpass-nologin; rm -f /tmp/pathpass-nologinExpected result
maintenance in progressKey points
- /etc/nologin
- Blocks non-root logins
- Content can explain why
Notes
- Environment: GNU coreutils / /tmpの一時ファイル
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Protected account data
Sensitive authentication data stored separately from ordinary account records.
Service availability
Whether a service can start automatically or be activated on demand.
Packet filter
A host firewall rule set that permits or rejects network packets.