You Asked: How Do I Restrict a Root User in Linux?
Contents

The simplest method to disable root user login is to change its shell from /bin/bash or /bin/bash (or any other shell that permits user login) to /sbin/nologin , in the /etc/passwd file, which you can open for editing using any of your favorite command line editors as shown.

How do I restrict users in Linux?

Limit User’s Access To The Linux System Using Restricted Shell. First, create a symlink called rbash from Bash as shown below. The following commands should be run as root user. Next, create an user called “ostechnix” with rbash as his/her default login shell.

How do I stop root user?

Just type exit and you will leave the root shell and get a shell of your previous user.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest