If applying maintenance or perhaps for other troubleshooting the need to disable all users from accessing the system. This can easily be accomplished by creating the file /etc/nologin. When a non-root user attempts to login, the system blocks the login. To enable user login, erase the /etc/nologin file.
Be aware, if root logins are disabled, you only have console access by root. So if you are connected remotely, do not disconnect or you will be visiting your console in order to connect again. So be sure to remove the /etc/nologin file before logging out. Also note