Question: How Do I Restrict Root Access 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...
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 a root user?
From the menu bar in Directory Utility:
- Choose Edit > Enable Root User, then enter the password that you want to use for the root user.
- Or choose Edit > Disable Root User.
How do I prevent root from reading a file?
Yes, there are ways to prevent root from overwriting files.
- Set the immutable bit with chattr ( +i sets, -i unsets). Requires root access, works only on ext2/ext3 (presumably ext4 too), but is otherwise practical.
- Don’t run apps as root. No root privs, no overwriting files. …
- Unmount the filesystem. …
- Turn off computer.