How To: Prevent non Root users from logging into Linux

You can prevent non-root users from logging into Linux using this simple trick.

Just login as root (administrator) and create an empty file /etc/nologin. And enter a message of your choice in the file.

From here on, any non-root user who tries to login to his account in Linux will be displayed the message in the /etc/nologin file. And the system will not allow the user to login.

If you want to reverse this process, just login as root again and delete the /etc/nologin file. And your system is back to normal.

This technique is useful if you want to bar normal users from logging into your system while some system maintenance work is going on.

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Related posts: