From the course: Linux System Engineer: Networking and SSH

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Restricting root logins with SSH

Restricting root logins with SSH

From the course: Linux System Engineer: Networking and SSH

Start my 1-month free trial

Restricting root logins with SSH

- [Instructor] It's generally a bad idea to log into a server as the root user. Logging in as a regular user and then elevating privileges via sudo, or the su command, is a much better strategy. If we allow root logins, even if the password is very strong, then hackers will target that account. The solution is to restrict root logins by way of SSH which is fairly easy to do. For this exercise it doesn't matter which VM you use, I'll be using the rhhost1 VM. Let's make sure that we can login to your VM now as root. Type in ssh space root@localhost and hit Enter. Type in yes to accept the fingerprint and then type in your root user password. This shows that we can log in as root. Having a strong password is a good idea but not allowing root logins is a better idea. Type in exit to logout. Let's open the sshd_config file in vi. Type in sudo space vi space/etc/ssh/sshd _config, and hit Enter. Type in your password. And then search for the word permit by pressing the forward slash and then…

Contents