Shree krishna lamichhane
Shree Krishna Lamichhane

Shree Krishna Lamichhane

Change default password of root user on aws ubuntu ec2 instance

Shree krishna lamichhane
·Jun 23, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

First ssh into your server using the ssh key.

ssh -i "Mysecretkey.pem" ubuntu@ec2-ip.compute-1.amazonaws.com

Once you are logged in, switch to root user with the following command

su root -

Then run passwd root

It will ask for the new password

New password: // Enter new password here
Retype new password: // Re-Enter new password here

Once everything is correct, you will get the success message

passwd: password updated successfully

Congratulations, you have successfully changed your root password.

Also, to change the password of the specific user, you can repeat the same procedure, just provide the different username with the switch user (su) command.

That's it !

 
Share this