-
Edit the SSH config file:
sudo nano /etc/ssh/sshd_config
-
Find the line
PermitRootLogin
and set it tono
-
Save and exit the file
-
Restart SSH:
sudo systemctl restart sshd
Make sure you have a separate user with sudo privileges before disabling root login.