Disable root login

We shouldn't stop there. Now that we have access to a user with sudo privileges, we don't need to log in as root anymore. Therefore, we should disable root login through another configuration entry in the sshd_config.

Find the PermitRootLogin entry and set that to no:

PermitRootLogin no

Reload the SSH daemon to ensure that this change takes effect:

root@hobnob:# systemctl reload ssh.service

Now, from your local machine, try to log in as root; you should get an error:

$ ssh root@142.93.241.63Permission denied (publickey).

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.