In case of any emergency maintenance activity, if you want to prevent users login to the server follow the steps.
This will not control root user login.
This system is down for maintenance.. No logins are permitted until 7.00 AM
When a normal user logs in, the message in the /etc/nologin will be display and the login is rejected. Once maintenance window got completed, you can remove the file or if you reboot the machine automatically this file got deleted.
This is common for Linux, Solaris and AIX. In Linux, ensure the line account required pam_nologin.so is added in the /etc/pam.d/ssh file