Finding root password

7,829

By default, on Ubuntu, there is no password for the root account. To run a command as root, you must run sudo, which asks for your own password. The Ubuntu installation creates one account with sudo privileges and asks you to enter a password for that account.

If you've forgotten the password, you'll have to change it. First, you need to be able to run a command as root (as a non-privileged user, you'd have to enter the current password to change it). The easiest way to do this if you aren't fluent with the Linux command line is to boot the Ubuntu installation media and select “rescue” rather than “install” at the menu. Alternatively, at the boot menu (you may need to press and hold Shift when your computer is booting, after the BIOS has initialized, to see the boot menu), select the “rescue” option or edit the command line to add init=/bin/bash at the end — see Lost Password in the Ubuntu community documentation for more details (this page may not be very up-to-date).

Once you get a command line as root, run this command to change your password:

passwd joe

(where joe is your user name). Then reboot into your normal system, and don't forget the password this time.

Share:
7,829

Related videos on Youtube

user654019
Author by

user654019

Updated on September 18, 2022

Comments

  • user654019
    user654019 over 1 year

    I installed a Ubuntu and it only has a user. I can login to the system without login. It doesn't ask me for un/pwd. but when I am in, and I want to run some commands as root (sudo), it ask for password and not allowing me to run it. No password works. How can I find password for this user or root?

    • Admin
      Admin over 11 years
      When you use sudo you use your own password.
  • user2914606
    user2914606 almost 11 years
    sudo uses your user password, not the root password. and besides, if an account doesn't have a password just hitting enter never actually works, in my experience.