How Do I Lock a Root User in Linux?
Contents in Order to Lock the Root Account, You Have to Use the “Usermod” Command with the “-L” Option for “Lock” and Specify the Root Account. How Do I...
Contents
In order to lock the root account, you have to use the “usermod” command with the “-L” option for “lock” and specify the root account.
How do I restrict a root user in Linux?
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. Save the file and close it.
Must Read
How do I lock a user in Linux?
UNIX / Linux : How to lock or disable an user account
- To lock a users account use the command usermod -L or passwd -l. …
- The commands passwd -l and usermod -L are ineffcient when it comes to disable/lock user accounts. …
- Expiring an account via use of the 8th field in /etc/shadow (using “chage -E”) will block all access methods that use PAM to authenticate a user.