In addition to the above methods, there is a generic way to refuse
logins by creating the file /etc/nologin. Usually this method is used for
short-term maintenance operations. Logins by root will still be allowed,
but logins by other users will be denied. For example:
# cat > /etc/nologin
==============================================
System is currently undergoing maintenance
until 2:00. Please come back later.
==============================================
# telnet localhost
login: agriffis
Password:
==============================================
System is currently undergoing maintenance
until 2:00. Please come back later.
==============================================
Login incorrect
Be sure to delete the file when you're done with maintenance, otherwise
nobody will be able to login until you remember! Not that I've ever done
this, no, not me... ;-)