Allow SSH root login on Ubuntu 20.04 Focal Fossa Linux

 

  1. Open the /etc/ssh/sshd_config file with administrative privileges and change the following line:

    FROM:
    #PermitRootLogin prohibit-password
    TO:
    PermitRootLogin yes
    
    

    The quick way to do this job could be just to simply use the sed command as shown below:

    sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
    
    
  2. Restart SSH service:

    $ sudo systemctl restart ssh
    
    
  3. By default the root’s password is not set on Ubuntu 20.04 and the error message Permission denied, please try again will appear when attempting to SSH login as a root user. From this reason we need to set root’s password. When prompted enter your current user password followed by new root password:

    $ sudo passwd
    [sudo] password for linuxconfig:
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    
    


  1. Given that your Ubuntu 20.04 system allows incoming traffic on port 22/ssh, you should now be ready to SSH login as root:

    $ ssh root@ubuntu-server
    root@ubuntu-server's password:
    Welcome to Ubuntu Focal Fossa (GNU/Linux 5.3.0-23-generic x86_64)
    
    

Related posts

How to change SSH Default Port in CentOS 8

The SnapAPI kernel module is not loaded for the kernel

Hướng dẫn mount ổ đĩa 4TB vào máy chủ Linux