 Community

 Ask!

 Developer

 Design

 Hardware

 Shop

 More ›

Stack Exchange sign up log in

Ask Ubuntu

 Questions

 Tags

 Tour

 Users

 Ask Question

Tell me more × Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required. How do I reset a lost administrative password? up vote 88 I'm working on a Ubuntu system using a Panasonic CF-50 Laptop. My Client down vote has completely forgotten his Administrative Password. He doesn't even favorite remember entering one; however it is there. 53 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. Do you have a solution? I look forward to hearing your response.

password edited Sep 19 '12 at 3:24

asked Jan 30 '11 at 14:50 share improve this question user9904 Sergey 17.3k2447 reboot the machine in single user mode. debuntu.org/recover-root-password- single-user-mode-and-grub – aspitzer Jan 30 '11 at 14:59 Try following these instructions: psychocats.net/ubuntu/resetpassword – csgeek May 12 '12 at 2:46

13 Answers active oldest votes

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.

Boot up the machine, and after the BIOS screen, hold down the left Shift key. You will then be prompted by a menu that looks something like this:

up vote 108 dow n vote

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 either root or netroot (doesn't matter in this case) and then hit Enter.

You should now see a root prompt, something like this: root@ubuntu:~#

At this stage it is possible you have a read-only filesystem. You have to remount it with write permissions: mount -rw -o remount /

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): passwd jorge Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@ubuntu:~#

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.

 Recovery Mode documentation

 Lost password documentation

answered Jan 30 '11 at 17:03

edited Aug 20 '12 at 17:00 share improve this answer

Jorge Castro 23.2k50221445 I just tried it and passwd username worked. I'm very surprised. Why is this not considered a security issue? (especially for desktop PCs) – Mohamed Meligy Sep 23 '12 at 5:42 It isn't a security issue, because you still have to be sitting in front of the machine 13 to do this. And if you have physical access to the computer you can do pretty much anything to it anyway. – Bobble Oct 3 '12 at 0:51 Just to follow-up on Bobble's correct comment: if you have physical access to a machine, you can take the disk out and mount it on a totally separate system 3 where you do have root. Just as one example. The only protection against full data compromise in the face of physical access is strong disk encryption. – arielf Mar 3 at 19:59 I had to go the route of editing the boot command. But your note here about remounting was the bit I was missing. Here is how to edit the boot command: makeuseof.com/tag/how-to-reset-any-linux-password – ChronoFish May 17 at 1:22 up vote Yes you can change the old password via Grub 18 down 1. If you have a single-boot (Ubuntu is the only on your vote computer), to get the boot menu to show, you have to hold down the Shift key during bootup

2. If you have a dual-boot (Ubuntu is installed next to Windows, another 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

3. From the boot menu, select recovery mode, which is usually the second boot option.

4. 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 5. 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.

6. To reset the password, type passwd username where username is the username you want to reset eg. passwd mysterio in my case

7. 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.

8. Now the password should be reset. Type exit to return to the recovery menu.

9. 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!

Hope this helps. Sorry I couldn't add images as I'm on my phone

edited Apr 1 '12 at 4:17 answered Mar 31 '12 at 21:49

share improve this answer

Alaa Mysterio 764313 2,59343374 This offers a route for when you forget both userid and password, which would also work with @Jorge Castro's answer. – Bobble Oct 3 '12 at 0:59

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:

1. My USB keyboard did not work at the root prompt ⋯ probably hardware either keyboard or mainboard. The fix I used was find an old PS/2 keyboard (the little round plug) and use that. up vote 2. When I used passwd username to change my password, it failed because of a 11 bad token or such. This called for drastic measures. down vote 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: mount -o remount,rw /

 Now you are a super-user on this system. Tread lightly.

Then edit the password shadow file to remove the encrypted password for your username. Type in… nano -B /etc/shadow

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: username:$1$amFeNcjp$PprjCKEVk3UtzKwWfEMOY0:14920:0:99999:7::: where $1$amFeNcjp$PprjCKEVk3UtzKwWfEMOY0 is the encrypted password.

Carefully delete the encrypted password leaving the all the ":"s, so it looks like this: username::14920:0:99999:7:::

Then type Ctrl-O, hit 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.

edited Mar 30 '12 at 0:40 answered Dec 2 '11 at 20:55

share improve this answer

David keepitsimpleengineer 752421 1,6381031 You can also use this method by with a different disk and editing 2 /etc/shadow after mounting the appropriate disk. – David Mar 29 '12 at 23:52 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 run

$ sudo -i [sudo] password for myuseraccount: # here you type the user's password #

A lot of people that have Unix background or experience with other distributions stumble on this issue quite often. up vote The command 10 down su vote will always fail because the root account is locked; it cannot be accessed directly or you cannot login directly to root.

There are great advantages in using the sudo facility.

edited 17 hours ago answered Jan 30 '11 at 15:58

share improve this answer

guntbert user4124 2,4452726 4,047721 I prefer sudo -s to sudo su -. Of course, if you need "root login shell", then do sudo su - root by all means. – Mikko Rantalainen Dec 12 '12 at 10:05 @MikkoRantalainen, I just changed the sudo command above, your comment might be obsolete now :-) – guntbert 17 hours ago up vote 7 down I was able to use Jorge's method - the one above with the nice screen shots - with a vote 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.

answered Jan 1 '12 at 3:14

share improve this answer

Henry Schaffer 7111 up vote 5 down If you forgot you password for your Ubuntu system you can recover using the vote following steps:

1. Turn your computer on.

2. Press ESC at the grub prompt.

3. Press e for edit.

4. Highlight the line that begins kernel ...... , press e

5. Go to the very end of the line and add rw init=/bin/bash

6. press enter, then press b to boot your system. Your system will boot up to a passwordless root shell.1

7. Now issue the command passwd username *where "username" is the user for which you want to change the password.

8. Then you will be asked to give new password:

Enter new UNIX password:

1Source:ubuntugeek

Other Resources:

Ubuntu Documentations Ubuntu Help

Psychocats

edited Apr 26 at 9:56 answered Jul 18 '12 at 19:55

share improve this answer

Radu Maris Mitch 236213 15.6k62551 The OP may not know what to do at the shell. – ObsessiveSSO Ⅎ Jul 18 '12 at 20:10 up First, you have to reboot into recovery mode. vote 4 down If you have a single-boot (Ubuntu is the only operating system on your computer), to vote 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 ls /home

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 passwd username where username is the username you want to reset. In this case, I want to reset Susan's password, so I type passwd susan

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

answered Apr 1 '12 at 2:51

share improve this answer

Ringtail 9,339723127 up vot You can change your password if you have access to the file /etc/shadow (maybe with e 3 your root account, via sudo from anotother account, from recovery mode, or with a do LiveCD/DVD). wn vot This shadow password file has all the users and encrypted passwords (as well as other e administrative information) for the system. The fields are separated by : . For example :

YOUR_USERNAME: $6$lCu1.iVo$Q3nAL98jBLe5mMJ.0dBDd1Iquz41dDKsP3UdJ4X92gZPwwmQ0vdIEIY8EQx EcYACoMboYhovrpyq7Tm.DztQB.:15520:0:99999:7:::

The password is the second group of characters after YOUR_USERNAME, between the two colons. You can replace this with a other password, for example, you could replace the existing password string (truncated for clarity):

$6$lCu1.iVo$Q3nAL98jBLe5mMJ.0[...]boYhovrpyq7Tm.DztQB.

with

$6$8gMLdPVn$Ych6r5ysKRqhL9jOlg0UPe28KRuzo3TSYMShqb5pzACrE/A0oyDEBFefOgp lbboeoe0T9ZqNz7u6Y8YWuQRkz/

The encrypted string represents "hackme". This would be your new password. edited Nov 3 '12 at 22:30 answered Jul 18 '12 at 19:57

share improve this answer

belacqua Andrés Ricardo Torres Martínez 7,26163366 365214

No, there is "no way" to retrieve the old password.

Yes, you can change the password without knowing the old one. The process is described on several sites on the net, easily found via a search ( http://www.google.com/search? client=ubuntu&channel=fs&q=change+frogotten+password+ubuntu&ie=utf-8&oe=utf- up 8 ) vote 2 If you do that however and happened to have used an encrypted /home-directory for that dow username you are likely not to gain access to the files in your /home-directory (and if n you do then Ubuntu should be uninstalled...) vote answered Mar 31 '12 at 21:41

share improve this answer

user52904 291

In which OS have you forgot the password, Ubuntu or XP? For Ubuntu, in the boot GRUB menu, you may append init=/bin/bash to the kernel boot parameter to get a up root shell. vote 2 answered May 12 '12 at 2:44 down vote share improve this answer

Xiè Jìléi 1,55951126 It is the password of Ubuntu my friend .And I got it done .Any way a big thanks to you too for your kindness Xie. – Noah Diaz May 12 '12 at 3:21 On the askubuntu site you ask for Windows Xp? :D – saji89 Sep 19 '12 at 4:11 up vote 1 down These answers seem to re-open the debate on Security versus Convenience. vote Libre Office advises that if you forget a password to a file, it cannot be retrieved, and I believe M$ Excel and Word operate similarly. If I boot my computer in Windows "Safe" mode (equivalent of "Recovery"), I do not need a password or even administrative privileges to log in as Super- administrator, which parallels the Linux situation described above. However, I could put one in, which in the event of my computer being lost or stolen would mean that Windows is more secure than Linux.

I am not suggesting that Linux should, or even could change this as the system is certainly more secure against the much greater threat of hacking, but does it not mean we must always be aware that we are not as private as we would like to be?

answered Nov 19 '12 at 8:20

share improve this answer

WGCman 877 We can put a password to the Linux Ubuntu root too! Encrypted filesystem is the only security, whether Linux or Windows. Privacy isn't an issue here. Privacy comes into play when you are online. – Sri May 15 at 5:18

From the official Ubuntu LostPassword documentation:

1. Reboot your computer

2. Hold shift during boot to start GRUB menu

3. Highlight your image and press 'e' to edit

4. Find the line starting with "linux" and append rw init=/bin/bash at the end of that line

5. Press ctrl-x to boot. up vote 1 down 6. Type in passwd username vote 7. Set your password.

8. Type in reboot. If that doesn't work, hit ctrl+alt+del

This works for 14, too. Keyboard-Layout

QWERTY

share improve this answer answered Mar 11 at 16:35 moose 4441417

Somehow booting into recovery mode did not work for me because it would not boot into the root system. And when I tried to change the root password it asked me for the root password, which I didn't have. An alternative to this problem is using UXterm which is a simpler version of terminal and seems to have root system capabilities. Just type in "passwd" and enter your new password and it's changed. up vote This works fine for Ubuntu 1.10. to bring up command line. Enter sudo passwd root. -1 down Enter new password 2X. back to GUI. Logout, then login as root to test. vote edited Jun 17 '12 at 18:19 answered Mar 29 '12 at 23:25

share improve this answer

Community♦ KoVo 1 466 This unfortunately won't work for most cases. – belacqua Nov 3 '12 at 22:32 protected by Community♦ Apr 10 '12 at 0:46

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site. tagged password × 632 asked 2 years ago viewed 140493 times active today 15 votes · comment · stats

Get the weekly newsletter!

 Top questions and answers

 Important announcements

 Unanswered questions see an example newsletter

Linked

24 How to NOT become a root user? Are administrators root?

10 How do I reset a lost password (using recovery mode requires me to type the password)?

8 I deleted the “/etc/passwd” file and cannot log in

3 How do I login as root?

2 What is the default password for Ubuntu 12.04?

2 Authenticate user that has no password?

0 I seem to have forgoten my password 1 How do I reset password in Ubuntu 11.10

1 Change user password while password is empty

0 How can I delete an administrator account from the guest login? see more linked questions…

Related

5 How to reset lost user password on a guest on VMWare server?

3 How to change the User password

10 How do I reset a lost password (using recovery mode requires me to type the password)?

-1 Is there a way to reset Windows XP administrator password?

0 I lost my password guys

1 I disabled login options, how do I reset my password?

1 How to remove encryption password

0 How to reset my password?

-3 Server 2003 password reset HELP!

0 How to change administrator password? question feed about help badges blog chat data legal privacy policy jobs advertising info mobile contact us feedback Culture / Technology Life / Arts Science Other Recreation

1. Stack 1. Progr 1. Datab 1. Photo 1. Engli 1. Math 1. St Overf amme ase graph sh emati ac rs Lang k uage A 2. Unix & p & Usag ps low Linux e 2. M 2. Serve 3. Ask 2. Skep et r Differ tics y a Fault ent Admi St (Appl nistrat 3. Mi 2. Scien cs ac 3. Super e) ors Yode ce k User ya Fictio 2. Cross O 4. Word 2. Drupa (Juda n & Valid v 4. Web Press l ism) Fanta ated er Appli Answ Answ sy (stats) fl catio ers ers 4. Trav o ns el 3. Seaso 3. Theor w 5. Geogr 3. Share ned etical 5. Ask aphic Point 5. Chris Advic Comp 3. A Ubun Infor tianit e uter re tu matio 4. User y (cook Scien a n Exper ing) ce 5 6. Web Syste ience 6. Arqa 1 maste ms de 4. Home 4. Physi rs 5. Math (gam Impro cs 4. St 6. Electr emati ing) veme ac 7. Game ical ca nt 5. more k Devel Engin 7. Bicy (7) O opme eering 6. more cles 5. more v nt (14) (13) er 7. Andro 8. Role- fl 8. TeX - id playi o LaTe Enthu ng w X siasts Gam C es ar 8. IT ee Securi 9. more rs ty (21) site design / logo © 2013 stack exchange inc; user contributions licensed under cc-wiki with attribution required rev 2013.6.8.731 Ubuntu and Canonical are registered trademarks of Canonical Ltd.