Enable root SSH login on Ubuntu 22.04
Steps for enabling root SSH login on Ubuntu 22.04, with configuration validation and important security precautions.
Ubuntu normally keeps direct root login disabled. The original guide explains how to enable it over SSH. This gives a remote account unrestricted control, so first consider signing in as a normal user and using sudo. Keep a separate working SSH session open while changing the configuration.
Set a root password if you intend to use password authentication:
sudo passwd rootEdit the OpenSSH server configuration:
sudo nano /etc/ssh/sshd_configFind the
PermitRootLoginsetting and set it toyes. If you intend to use a password,PasswordAuthenticationmust also be enabled; check other effective settings and included configuration files.PermitRootLogin yesValidate the configuration before restarting the Ubuntu SSH service:
sudo sshd -tsudo systemctl restart sshNow try signing in as root from another terminal. Confirm access before closing your existing session:
ssh root@server_ip_address
Security
Security: password-based root SSH access increases exposure to guessing and credential theft. Prefer an ordinary account with sudo or, if direct root access is necessary, public-key authentication with password login disabled.
Share
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0