Blog

How to set root password for ubuntu servers

If you are having cloud instances, that provide you key files (pem/ppk) to login to your instances/servers, this post is suitable to you.

In this case, for security purposes, providers don’t allow users to login with root password but yet for some circumstances, if you want to set root password, follow below-mentioned steps.

1. Log into your instance/server through provided pem/ppk file.
2. fire below mentioned command

sudo su 

3. Change below-mentioned file with mentioned content

vi /etc/ssh/sshd_config

PermitRootLogin yes
PasswordAuthentication yes

4. save file and do

service ssh restart

5. now, let’s set root user’s password
6. First verify you are in root user

whoami         # if it's root
passwd         # it will ask you to type password, enter it 2 times and your password is setup.

Finally, try to login with root credentials and see if it works.
If you face any issues, feel free to comment below

Read our other blogs here

Drafted on: 1st April 2020

Leave a Comment