Like several previous release, Ubuntu Server 20.04 LTS doesn't give a password to root. This behavior from Ubuntu claimed to be more secure than have a password for root. But you can still doing ssh remote directly to your root Ubuntu Server even without a password by using RSA key pair without making change to this secure behavior.
In this post, I am using a newly installed Ubuntu Server 20.04 with OpenSSH server installed and without changing anything in
sshd_config
file. Some people will just gives a password to root and making a change in /etc/ssh/sshd_config to permit root login, etc.Also we are not gonna using
PuTTY
, but native Windows 10 Command Prompt with OpenSSH client enabled. For you who didn't no about OpenSSH client in Command prompt yet, please read this previous post: Enable OpenSSH Client on Windows 10, PuTTY on Command Prompt.How to remote SSH to Ubuntu Server 20.04 root Without Password Using Windows Command Prompt
- Open Windows Command Prompt
- Go to your user folder
cd %userprofile%
- Go to .ssh folder
cd .ssh
- Create RSA key pair using Command Prompt
ssh-keygen
ssh-keygen
will create 2 new files, usedir
command to list files in the .ssh directory
C:\Users\Andra\.ssh>dir Volume in drive C is Local Volume Serial Number is 50F0-0618 Directory of C:\Users\Andra\.ssh 25/06/2020 23:23 <DIR> . 25/06/2020 23:23 <DIR> .. 25/06/2020 23:23 1.679 id_rsa 25/06/2020 23:23 411 id_rsa.pub 25/06/2020 23:22 173 known_hosts 3 File(s) 2.263 bytes 2 Dir(s) 14.200.655.872 bytes free
id_rsa
is your private key andid_rsa.pub
is your public key.- Open id_rsa.pub with notepad, this command will do it
notepad id_rsa.pub
Open id_rsa.pub with notepad |
- Copy all the content, and we will paste it later to Ubuntu Server
- Now, remote ssh to your Ubuntu Server using normal sudoers user and password
ssh user@ipaddress
- Edit or create authorized_keys file in root .ssh folder
sudo nano /root/.ssh/authorized_keys
- Copy the content of id_rsa.pub from notepad and paste it to ssh Command Prompt by right click on the terminal
- Open a new Command Prompt Window and remote ssh to the server root
ssh root@ipaddress
- If anything goes right, you'll log in to your Ubuntu Server 20.04 root without password
I am working on the video on How to remote SSH to Ubuntu Server 20.04 root Without Password Using Windows Command Prompt, it will be a short video. Keep alert by subscribing to my youtube channel https://www.youtube.com/channel/UC4SMlEsxgVhLs7BeKwjyq7g/