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.

Enable root SSH login on Ubuntu 22.04

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.

  1. Set a root password if you intend to use password authentication:

    sudo passwd root
  2. Edit the OpenSSH server configuration:

    sudo nano /etc/ssh/sshd_config

    Find the PermitRootLogin setting and set it to yes. If you intend to use a password, PasswordAuthentication must also be enabled; check other effective settings and included configuration files.

    PermitRootLogin yes
  3. Validate the configuration before restarting the Ubuntu SSH service:

    sudo sshd -t
    sudo systemctl restart ssh
  4. Now 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 Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0