I'm working on a Ubuntu system, and my client has completely forgotten his administrative password. He doesn't even remember entering one; however it is there.
I've tried the suggestions on the website, and I have been unsuccessful in deleting the password so that I can download applets required for running some files. Is there a solution?
By default the first user's account is an administrative account, so if the UI is prompting you for a password it's probably that person's user password. If the user doesn't remember their password you need to reset it. To do this you need to boot into recovery mode (see also offical docs: RecoveryMode).
Boot up the machine, and after the BIOS screen, hold down the left Shift key (note that for UEFI BIOS you might need press ESC instead). You will then be prompted by a menu that looks something like this:
I've noticed on some systems that timing when to hit the left Shift key can be tricky, sometimes I miss it and need to try it again.
Hit the down arrow until you select the 2nd entry from the top (the one with the recovery mode in the description) and then hit Enter.
Now you should see this menu:
Using the arrow keys scroll down to root and then hit Enter.
You should now see a root prompt, something like this:
At this stage you should have a read-only filesystem. You have to remount it with write permissions:
Now we can set the user's password with the
passwd
command. (In this example I will use jorge as the example, you need to substitute whatever the user's username is):Type in what you want the new password to be at the prompt. After it's successful reboot the machine and the user will be able to log in with their new password.
There is concern about this being a security vulnerability. It is not. You need to have physical access to the machine to do this. If someone has physical access to your PC, they could do far worse than change a password. When it comes to physical access, the battle for security is lost. Be wary of who you let on your PC.
Even setting a root password will not be successful, as one can simply boot with
init
being/bin/sh
and have full root access. Again, given physical access, anyone with computer knowledge can do ANYTHING to your computer.Yes, you can change the old password via GRUB.
If you have a single-boot (Ubuntu is the only operating system on your computer), to get the boot menu to show, you have to hold down the Shift key during bootup.
If you have a dual-boot (Ubuntu is installed next to Windows, another Linux operating system, or Mac OS X; and you choose at boot time which operating system to boot into), the boot menu should appear without the need to hold down the shift key.
From the boot menu, select recovery mode, which is usually the second boot option.
After you select recovery mode and wait for all the boot-up processes to finish, you'll be presented with a few options. In this case, you want the Drop to root shell prompt option so press the ᛎ Down arrow to get to that option, and then press Enter to select it.
Once you're at the root shell prompt, if you have forgotten your username as well, type
ls /home
(small letters & not capitals). This will list all the user accounts in your set up.To reset the password, type
passwd username
where username is the username you want to reset, for example,passwd mysterio
in my case.You'll then be prompted for a new password. When you type the password you will get no visual response acknowledging your typing. Your password is still being accepted. Just type the password and hit Enter when you're done. You'll be prompted to retype the password. Do so and hit Enter again.
Now the password should be reset. Type
exit
to return to the recovery menu.After you get back to the recovery menu, select resume normal boot, and use Ubuntu as you normally would — only this time, you actually know the password!
If you forgot the password for your Ubuntu system you can recover using the following steps:
Turn your computer on.
Press ESC at the GRUB prompt.
Press e for edit.
Highlight the line that begins
kernel .........
orlinux ........
, press eGo to the very end of the line and add
rw init=/bin/bash
Press Enter, then press b to boot your system. Your system will boot up to a passwordless root shell.1
Now issue the command
passwd username
*where "username" is the user for which you want to change the password.Then you will be asked to give new password:
Enter new UNIX password:
1Source: ubuntugeek
Other resources:
Ubuntu Documentation
Ubuntu Help
Psychocats
For Xubuntu 14.04 just follow the screens below. It's similar to some of the other answers.
Press Esc, and choose Advanced options
Choose recovery mode:
Then choose root, and once you get the prompt type
passwd <user_name>
, to change the password.If Jorge's method didn't work for you, as it didn't for me, here is another method. I had to try something different because:
My USB keyboard did not work at the root prompt ⋯ probably hardware either keyboard or mainboard. To fix I used an old PS/2 keyboard (the little round plug) and use that.
When I used
passwd username
to change my password, it failed because of a bad token or such. This called for drastic measures.The Drastic Measures
This is a very dangerous thing to do! Jorge's method should be used; only do this in case that method doesn't work.
Do this at your own risk. It did work for me on my 11.10 system.
The idea is to set the user's password to blank (or null) - this allows you to just press Enter at the
Password:
prompt.Still at the root prompt from Jorge's method, first remount the root file system as read-write by using this command:
Then edit the password shadow file to remove the encrypted password for your username. Type in:
The nano editor will display the contents of the file. Each line will have the form
name:⋯:⋯:⋯…
where ⋯ is a string or null (empty). One of the lines will start with your username. The first ⋯ after your username is your encrypted password. As an example:where
$1$amFeNcjp$PprjCKEVk3UtzKwWfEMOY0
is the encrypted password.Carefully delete the encrypted password leaving the all the ":"s, so it looks like this:
Then type Ctrl+O, press the Enter key to save, then Ctrl+X to close nano.
Reboot and you will have an empty (or null) password. Be sure to use
passwd username
in a terminal to set or reset your user password.Source for PS/2 workaround was here.
Sources for the drastic measures were here and here.
Note on nano ― the
-B
option makes a backup of the original edited file, same name with a "~" appended.If recovery mode is disabled, the method I would use is booting to a Live CD or USB. It could be the media you installed from or just another Ubuntu ISO you've downloaded and burnt. The process is fairly simple.
sudo fdisk-l
will list all partitions. Derive your partition from the list. We're looking for something like/dev/sda1
(which it will likely be)Mount this somewhere so we can use it (obviously change the disk to the right one):
Cross-mount things from the Live install so we can "use" the mounted disk (just copy and paste):
Become root on the system by running
sudo chroot /mnt
. You can now do anything root can on the real install.Set the password for the account:
Reboot and you're done.
Ubuntu does not come with an
Administrative
password. There is only one initial account, the user account, which can be used to execute administrative tasks. For example, to get a root shell you runA lot of people that have Unix background or experience with other distributions stumble on this issue quite often.
The command
will always fail because the
root
account is locked; it cannot be accessed directly or you cannot login directly toroot
.There are great advantages in using the
sudo
facility.From the official Ubuntu LostPassword documentation:
rw init=/bin/bash
at the end of that linepasswd username
reboot
. If that doesn't work, hit Ctrl+Alt+DelThis works for Linux Mint 14, too.
First, you have to reboot into recovery mode.
If you have a single-boot (Ubuntu is the only operating system on your computer), to get the boot menu to show, you have to hold down the Shift key during bootup. From the boot menu, select recovery mode, which is usually the second boot option. After you select recovery mode and wait for all the boot-up processes to finish, you'll be presented with a few options. In this case, you want the Drop to root shell prompt option so press the Down arrow to get to that option, and then press Enter to select it.
The root account is the ultimate administrator and can do anything to the Ubuntu installation (including erase it), so please be careful with what commands you enter in the root terminal.
Once you're at the root shell prompt, if you have forgotten your username as well, type
That's a lowercase L, by the way, not a capital i, in ls. You should then see a list of the users on your Ubuntu installation. In this case, I'm going to reset Susan Brownmiller's password.
To reset the password, type
where username is the username you want to reset. In this case, I want to reset Susan's password, so I type
You'll then be prompted for a new password. When you type the password you will get no visual response acknowledging your typing. Your password is still being accepted. Just type the password and hit Enter when you're done. You'll be prompted to retype the password. Do so and hit Enter again.
Now the password should be reset.
Type
exit
to return to the recovery menu.
After you get back to the recovery menu, select resume normal boot, and use Ubuntu as you normally would—only this time, you actually know the password!
source
I was able to use Jorge's method - the one above with the nice screen shots - with a few minor changes. I'm using Ubuntu 11.10
First, when booting up - don't press the left shift key until the BIOS screen goes black and then immediately press and hold the left shift key.
Then, after perhaps a minute and a number of lines of text scroll on the screen, I got the first menu, but with a couple of fewer lines - I chose the second line.
Then I got the Recovery Menu - but when I chose Drop to Root Shell Prompt (bottom item) I was root but couldn't reset the password - because the disks were Read Only. Type exit and get back to the Recovery Menu
There was a choice (not shown on Jorge's screen shot) to Remount Read/Write Used the down arrow to go to it, then left arrow to get to and Enter - and it mounted the disk RW.
Then again to Drop to Root Shell Prompt and I'm root and can write - so passwd username had me enter the desired password twice - then exit to go back to Recovery Menu Resume normal boot and everything worked fine with my new password! I'm the only account on this box, and my password works with sudo so I apparently have Administrative Privileges.
This was less exciting than editing /etc/shadow but I was glad to trade the excitement for a nice ending.
I was having the same problem with my password and I tried everyone's suggestions but none worked for me. So I tried some of my own and this is what worked for me... "Keep in mind I can NOT explain why it worked, all I know is it worked...
"10 Easy and Simple steps to Reset Lost or Forgotten Password"
Reboot computer and hold the Left Shift Key down.
Select boot into recovery mode.
After a few seconds you should get the "Recovery Mode Options" screen.
Note: (Here is the part I can't explain. After trying everything, and nothing working, I finally just started trying all the options here one at a time. When I tried the
"grub Update grub boot loader"
and then followed the rest of the steps all was well and password was reset.)So before going to the
"root Drop to root shell promt"
selection,Select
"grub Update grub boot loader"
, and you should get this screen.Select
"Yes"
. Wait for it to go through the update.Now select
"root Drop to root shell prompt"
.Now you should be at a root terminal with something like the following:
youracctname@yourcompname:~$.
typepasswd accountname
( acountname being the name of the account you are trying to change the password for ).Enter new Unix password:
"enter the new password".Retype new Unix password:
"retype the same password you did in Step-8".It should confirm successful password change. type
exit
at the prompt and reboot.If this does not work for you, try skipping Steps 4 & 5...