First, let's try your account from the console. WRITE DOWN THESE DIRECTIONS BEFORE BEGINNING - you won't be able to read from here once you start.
Press Ctrl-Alt-F1. This will bring you to a text only console. Log in with your username and password. Once you've accomplished that, do sudo -s
, and give it your password again. After doing that, press Press Ctrl-Alt-F7. This will bring you back to the usual graphical screen you're used to.
Were you able to log in at the shell? Were you able to successfully sudo to root (did the prompt change to root@yourmachine:~#
)?
OK. You've done this, and you cannot log in at all. So, you will need to reset the password for your username. First, try doing CtrlAltT to bring up the Terminal. Type in passwd
and hit enter. Will it allow you to change your password? If so, you should be good. If not, you'll need to boot to single user mode in order to reset your password.
If you could not change your password, let's get into Recovery Mode. Reboot the system, and at the GNU GRUB menu, press down arrow, and select (recovery mode) as shown here:
Now, drop to root shell prompt:
OK, now you'll need to remount your root filesystem read-write, and then you can change your password:
root@yourmachine:~# mount -o remount,rw /
root@yourmachine:~# passwd yourname
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@yourmachine:~# exit
NOTE: you may be confused about what your actual username is - it's not necessarily the same thing you see at the Ubuntu login prompt! For example, I see "Jim Salter" when I log into my workstation, but my actual username is something completely different and much shorter. If your system tells you there is no such user, you can do less /etc/passwd
to look for your actual account name - it should be towards the end of the file. Mine looks something like this:
myrealusername:x:1000:1000:Jim Salter,,,:/home/myrealusername:/bin/bash
Once you've successfully changed the password on your account, exit
, "resume normal boot", and log in as normal, with shiny new (working!) password.
Best Answer
You aren't supposed to add a password for the root account. We have something called the sudo mechanism to handle that. Instead, you add users to the
admin
account. All those users can then run commands or programs as root by runningsudo command
for terminal commands orgksu command
for GUI apps to run as root, such asgksu gcalctool
though that example obviously makes no sense)When you're being asked for a password when installing things, etc, it is your own password you should use. This way, it is possible to enable others to do administrative tasks without having to share passwords and keys. It is also configurable to allow someone to run a specific command as root, but not others, but you won't normally touch that.
The first user you created is by default the admin account.