I've just installed a new ubuntu server. It is a virtual machine hosted on Hyper-V. I'm trying to change the root password using the following commands:

sudo passwd

and then entering the new password.

Everything look fine until I reboot the server. Then only the old password works.

Could you please advise how to resolve this?

Thank you

  • Try sudo passwd root If you never got a confirm message you never changed it in the first place.
    – David
    Oct 14 at 10:08
  • Hello David, I received the message: passwd: password updated successfully but when I rebooted the server, still the same issue. Oct 14 at 10:40
  • You also should have said in the question what you had tried and I would not have told you to do something you had already done.
    – David
    Oct 14 at 10:58
sudo passwd

changes the admin password (that is the user used to create the system with) not the password for root. Anything related to root does not require sudo and will mess things up (as Ubuntu expects you meant the admin user when using sudo).

change the root password.

You change to root using

sudo -i

(requires the admin password) and then change the password for root with:


Mind that Ubuntu is not meant to be used with root. If you want that it is better to change to a system that does use that out of the box. Using root on Ubuntu can have unwanted side effects. sudo is a slight improvement over using root when it comes to security: hackers need your admin account name and the password. Using root means the former is known to all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.