Saturday, October 1, 2016

Disable Root SSH Login on Red Hat / Oracle Linux 7

Any Linux server should be configured to disable root login via SSH. This is one of many security best practices.

To do so:

1. Login as root to the server.

2. Edit the SSH config file:
[root@soahost1 ~]# vi /etc/ssh/sshd_config
3. Make the following change to the file:
OLD: #PermitRootLogin yes 
NEW: PermitRootLogin no
4. (Linux 5/6) Restart the SSH service:
[root@soahost1 ~]# /etc/init.d/sshd restart
5. (Linux 7) Restart the SSH service:
[root@soahost1 ~]# systemctl restart sshd.service

Applicable Versions:
  • Red Hat / Oracle Linux 5+, 6+
  • Red Hat / Oracle Linux 7+

No comments: