This rule emphasizes not using the 'root' user for administrative and daily tasks.
Rule | Eliminate use of the 'root' user for administrative and daily tasks |
Framework | cis_v140 |
Severity | ✔ High |
CIS Benchmark Rule: Eliminate Use of 'root' User
The Center for Internet Security (CIS) provides a set of best practice guidelines for securing systems, which includes a recommendation to avoid using the 'root' user account for administrative and daily operational tasks. The 'root' user, also known as the superuser, has unrestricted access to all commands and files on a Unix/Linux system and can perform actions that are restricted to normal users. Using this account for regular activities can pose significant security risks.
Why It's Important to Limit 'root' User Access
Troubleshooting Steps
Checking for 'root' User Usage
To see if and when the 'root' user has been accessed, check the authentication logs. For most Linux distributions, this log is located at
/var/log/auth.log
or /var/log/secure
.sudo grep 'root' /var/log/auth.log
Review the commands executed by the 'root' user by examining the command history.
sudo -i history
Determining Currently Logged-In Users
Run the
who
or w
command to identify which users are currently logged in and if any are logged in as 'root'.who w
Steps for Remediation
Step 1: Create Individual User Accounts
Create unique user accounts for all users requiring system access.
sudo adduser <username>
Step 2: Assign Necessary Privileges Using sudo
Give administrative privileges to trusted user accounts using the
sudo
command.sudo usermod -aG sudo <username>
Step 3: Limit sudo Access
Edit the sudoers file to restrict the commands users can run with sudo.
sudo visudo
Step 4: Implement Strong Authentication Mechanisms
Step 5: Regularly Check for Compliance
Step 6: Remove Unnecessary 'root' Access
If remote 'root' login is enabled, disable it in the SSH configuration.
sudo nano /etc/ssh/sshd_config # Set PermitRootLogin to no PermitRootLogin no sudo systemctl restart sshd
Step 7: Train Users
sudo
.Tips for Enforcing the Rule
By following these steps and diligently enforcing the no-root-user policy, you ensure a better security stance for your systems, reducing the risk of unauthorized access and potential damage.