Linux distributions
CIS-UBUNTU-5.2.8
Ensure SSH root login is disabled
HighLevel 1Automatedlinux
Description
The PermitRootLogin parameter specifies if the root user can log in using ssh.
How it is checked
Audit method: File pattern
- File
/etc/ssh/sshd_config- Pattern
(?m)^\s*PermitRootLogin\s+no\b
How it is fixed
Fix method: Shell command
shell
sed -i 's/^#*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_configProperties
- Operating systems
- ubuntu-22.04, ubuntu-24.04, rocky-9
- Tags
- sshserver
- Reference
- CIS Ubuntu Linux / Rocky Linux Benchmarks - Ensure sshd PermitRootLogin is disabled (verify section number for your release)
Check this host
Run this on a machine you are allowed to audit. The scan is read-only.
shell
tmaegis scan --target linux