Can't Reset Administrator Password

Asked by Ludwig Boyadjian on 2011-11-30


I am using Xubuntu 10.11. I some how forgot my administratror password. Tried to reset with

Does Not Work

Please Help

Thank you

Question information

English Edit question
Ubuntu shadow Edit question
No assignee Edit question
Solved by:
Ludwig Boyadjian
Last query:
Last reply:
Warren Hill (warren-hill) said : #1

Good day Warren

I tried it it does not work.

Warren Hill (warren-hill) said : #3

When does it go wrong

1. You get the grub boot menu and select recovery mode

2. Eventually this gives you an option to enter a root shell

3. You are now in the root shell

4 type ls /home
    This shows you a list of all users eg: Ludwig

5. You change Ludwigs Password
     passwd Ludwig
     then you enter the password

6 You type exit

7 You reboot and the new password is accepted.

I know I've listed all the steps in detail here but We are not going to solve this without knowing where its going wrong and what error messages you see if any.

So let us know how far you get. If for example you can't even select the recovery shell then you will need to make a live boot disk unless you have one already.

Hello Warren

I know thisis difficult to explain, but once I am in the root. It asks me to creat a password for maintenance or type control-D. so I creat a password then I am at root@username - desktop. following this I type passwd the system asks me for a new unix password I type a password then it asks me to retype the pass word whiich I do then I type exit. then I click on reboot. Once I am at login I type the new pass word that I have created and it does not recgonize. You see what basically I want is to regain my administrative priviliges so that I can download updates. etc and access my files which I didnot backup.

PS. The root shell does not recognize the command ls /home

Thank you

I will try this tognight EST.

Warren Hill (warren-hill) said : #5

That may be your problem. Linux creates a directory for each user inside "/home" This suggests there are no users set-up

When you start your system normally what user name does it show?

If this is "Guest" or "Anonymous" and you cant select anything else It would suggest very strongly that no users are set up.

I would normally check what user accounts are set-up by typing "ls /home"

Which on my system returns as shown

warren@wmh-lt:~$ ls /home

I am concerned that it does not recognize this command try "ls /" without the quotes you should see something similar to

warren@wmh-lt:~$ ls /
bin dev initrd.img lost+found proc sbin sys var
boot etc initrd.img.old media root selinux tmp vmlinuz
cdrom home lib mnt run srv usr vmlinuz.old

all these directories are standard.
Do you get an error that the commands not recognized or that the directory does not exist

Another way to check for user accounts would be "lastlog" which on my system shows

warren@wmh-lt:~$ lastlog
Username Port From Latest
root tty3 Sat Jul 16 20:45:37 +0100 2011
daemon **Never logged in**
bin **Never logged in**
sys **Never logged in**
sync **Never logged in**
games **Never logged in**
man **Never logged in**
lp **Never logged in**
mail **Never logged in**
news **Never logged in**
uucp **Never logged in**
proxy **Never logged in**
www-data **Never logged in**
backup **Never logged in**
list **Never logged in**
irc **Never logged in**
gnats **Never logged in**
nobody **Never logged in**
libuuid **Never logged in**
syslog **Never logged in**
klog **Never logged in**
hplip **Never logged in**
avahi-autoipd **Never logged in**
gdm **Never logged in**
saned **Never logged in**
pulse **Never logged in**
messagebus **Never logged in**
polkituser **Never logged in**
avahi **Never logged in**
haldaemon **Never logged in**
warren tty2 Sun Jul 17 09:16:35 +0100 2011
speech-dispatcher **Never logged in**
couchdb **Never logged in**
kernoops **Never logged in**
usbmux **Never logged in**
festival **Never logged in**
rtkit **Never logged in**
mysql **Never logged in**
smmta **Never logged in**
smmsp **Never logged in**
lightdm **Never logged in**
colord **Never logged in**

which in this case shows only two users have ever logged in "warren", thats me and "root"

Finally you can check users with "cat /etc/passwd"

warren@wmh-lt:~$ cat /etc/passwd
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
hplip:x:103:7:HPLIP system user,,,:/var/run/hplip:/bin/false
avahi-autoipd:x:104:110:Avahi autoip daemon,,,:/var/lib/avahi-autoipd:/bin/false
gdm:x:105:111:Gnome Display Manager:/var/lib/gdm:/bin/false
pulse:x:107:114:PulseAudio daemon,,,:/var/run/pulse:/bin/false
avahi:x:110:119:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
haldaemon:x:111:120:Hardware abstraction layer,,,:/var/run/hald:/bin/false
speech-dispatcher:x:112:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh
couchdb:x:113:116:CouchDB Administrator,,,:/var/lib/couchdb:/bin/bash
kernoops:x:114:65534:Kernel Oops Tracking Daemon,,,:/:/bin/false
usbmux:x:115:46:usbmux daemon,,,:/home/usbmux:/bin/false
mysql:x:118:127:MySQL Server,,,:/var/lib/mysql:/bin/false
smmta:x:119:131:Mail Transfer Agent,,,:/var/lib/sendmail:/bin/false
smmsp:x:120:132:Mail Submission Program,,,:/var/lib/sendmail:/bin/false
lightdm:x:121:133:Light Display Manager:/var/lib/lightdm:/bin/false
colord:x:122:134:colord colour management daemon,,,:/var/lib/colord:/bin/false

for information on how to read this see

In my case the important line is shown below


The third parameter is >999 so this a user account

Try all of these and let us know what you see.

You may have create a new user from root shell

This should give us enough information to work out whats gone wrong here. I'm hoping some of the more experienced users here are looking at this question and can help further

Hello Warren

Back home from work. ls /home is now working. i BELIEVE i DID NOT TYPED IT RIGHT IN THE FIRST PLACE I typed ls /home and i getin blue colors bach which is my administrator user name and guest.

After root@bach - desktop. I type passwd bach
the system asks for new UNIX password. I type my new password.
the system asks me to retype the new password which i do.


Warren Hill (warren-hill) said : #7

Its possible the permissions for the password file are wrong

while in the root shell try

ls -l /usr/bin

output should be similar to this

-rwsr-xr-x l root root 37132 2011-02-21 00:16 /usr/bin/passwd

dont worry about the date and time but the permissions must be "-rwsr-xr-x*

If not tell me what they are and I give you the command to correct it

if the permissions are correct

give me the output of

strace passwd

Warren Hill (warren-hill) said : #8

Ignore the post above its slightly wrong: READ THIS ONE INSTEAD

Its possible the permissions for the password file are wrong

while in the root shell try

ls -l /usr/bin/passwd

output should be similar to this

-rwsr-xr-x l root root 37132 2011-02-21 00:16 /usr/bin/passwd

dont worry about the date and time but the permissions must be "-rwsr-xr-x*

If not tell me what they are and I give you the command to correct it

if the permissions are correct

give me the output of

strace passwd

Good day Warren,

I tried what you told me and I got this result:

bash: no such file or directory for ls-l/usr/bin/passwd.

What seems the problem.


Warren Hill (warren-hill) said : #10

Sorry my mistake here

Command should be

ls -l /usr/bin/passwd

Note the extra space between "l" and "/"

Hello Warren

The answer given to the above command are:

-rwsr-x 1 root root 41284 2011-06-24- 05:36 and in color red /usr/bin/passwd.

I also tried cat/etc/passwd. All that gave me everytime I logged in but only as a guest user not as bach user which is the adminstrator user.

Again thanks

Warren Hill (warren-hill) said : #12


Can you check that again please. The permissions field looks too short. It should be 10 characters wide not 7.
On my PC it looks like this

root@wmh-lt:~# ls -l /usr/bin/passwd
-rwsr-xr-x 1 root root 41284 2011-06-24 10:36 /usr/bin/passwd

The way you read this is as follows

Understanding how to read this output is useful to all unix users, but especially people using group access permissions.

Field 1: a set of ten permission flags.
Field 2: link count (don't worry about this)
Field 3: owner of the file
Field 4: associated group for the file
Field 5: size in bytes
Field 6-8: date of last modification (format varies, but always 3 fields)
Field 9: name of file (possibly with path, depending on how ls was called)

The permission flags are read as follows (left to right)
position Meaning
1 directory flag, 'd' if a directory, '-' if a normal file, something else occasionally may appear here for special devices.
2,3,4 read, write, execute permission for User (Owner) of file
5,6,7 read, write, execute permission for Group
8,9,10 read, write, execute permission for Other
value Meaning
- in any position means that flag is not set
r file is readable by owner, group or other
w file is writeable. On a directory, write access means you can add or delete files
x file is executable (only for programs and shell scripts - not useful for data files). Execute permission on a directory means you can list the files in that directory
s in the place where 'x' would normally go is called the set-UID or set-groupID flag.

On an executable program with set-UID or set-groupID, that program runs with the effective permissions of its owner or group

I have never seen only 7 flags before.

Hello Warren,

My mistake the command given is:

-rwsr-xr--x 1 root root 41284 2011-06-24 05:36 usr/bin/passwd

The usr/bin/passwd is highlighted in red. If this mean anything

I have a question for you. Is there any restore point in UBUNTU like in Windows XP pro.?

My other question is I also have installed Windows Xp Pro. In any case if I have to reinstall UBUNTU again will it effect Windows in any way? I rather solve this problem--either recover my old password or be able able to creat a new one so that I can access my files and be able to download updates--without having to reinstalling UBUNTU again.

Once again Thank you for your help

Warren Hill (warren-hill) said : #14

I am not aware of anything like Windows restore points in Ubuntu but If anyone knows different please advise.

I am not sure where to go next. But If it was me I would now be looking at methods to back up and re-install.

I would probably start by going to my nearest computer shop any buying a USB external hard drive. This may seem an expense but It will give you somewhere to do regular back-ups to in the future so is probably a wise investment. Alternatively yo could use CDs or DVDs.

Since we can log on as a root shell we can get to the file system and back-up all the data that would otherwise be unrecoverable.

Then do a clean install and start again.

If any one reading has further suggestions please help.

Let me know what you decide and I will advise on what to do to back up your data.

Hello warren

I prefer to recover my old password or create a new one. Rather than reinstall xubuntu again.

I will try to use these commands:

sudo apt.get remove likewise-open or
sudo apt-get remove libnss-1 dap

I will let you know tonight EST.

Thanks again

Hello Warren,

I tried the link after which points here and I entered these commands sudo apt-get remove likewise-open and sudo apt-get remove libnss- l dap .

I retrived these answers from the system:

W: Not using locking for read only lock file /var/lib/dpkg/pck
E: Unable to write to /var/cache/apt/
E: The package lists or status file coul not be parsed or open.

Could you interpret and let me know,

Thanks again.

PS: Let me start from the beginning:

On tuesday morning I went on system - user group to add a password to the guest user for security purposes the system asked for my user passwords which I entered then I enetered a new password and I retyped the password the thing is I did not realized that my user password turned red and I initiated a submit. Since then then I am unable to use my password to login. as an administrator that is why I am in this situation now.

More info regarding System -- user group. When I tried to add a password to guest user and I tried to type my password after 3 times a window opened indicating that an error occured while checking for authorization did not receive a reply. possible causes include the remote application did not send a reply the message security policy blocked the reply the reply timed out or expired or the network connection was broken. You may report this as a bug. I don't know if this can help you located the problem and find a solution.

Thanks again

Warren Hill (warren-hill) said : #19

Sorry Ludwig,

I am no Linux expert, just a minor geek, and I am now running out of ideas. The first thing I would check is file permissions for these error messages so try the following commands and see if you get similar results to mine

 ls -al /var/lib/dpkg/pck

ls -al /var/cache/apt/

You should see something similar to this

# ls -al /var/lib/dpkg/pck
ls: cannot access /var/lib/dpkg/pck: No such file or directory
# ls -al /var/cache/apt/
total 108828
drwxr-xr-x 4 root root 4096 2011-12-04 11:17 .
drwxr-xr-x 24 root root 4096 2011-11-15 15:54 ..
drwxr-xr-x 2 root root 4096 2010-05-27 11:28 apt-file
drwxr-xr-x 3 root root 270336 2011-12-01 18:05 archives
-rw-r--r-- 1 root root 20897170 2011-12-04 11:16 pkgcache.bin
-rw-r--r-- 1 root root 25165824 2011-08-13 09:14 pkgcache.bin.JOTqbT
-rw-r--r-- 1 root root 25165824 2011-09-28 07:06 pkgcache.bin.PwDRLc
-rw-r--r-- 1 root root 20540904 2011-12-04 11:17 srcpkgcache.bin
-rw-r--r-- 1 root root 17521125 2011-09-28 07:06 srcpkgcache.bin.4NuWSa
-rw-r--r-- 1 root root 17347504 2011-08-13 09:14 srcpkgcache.bin.8LNVK1

If not this may give us a clue otherwise we resort to searching google

Try the link below

Hello Warren

I tried the above commands. Sorry they don't work. ls: cannot access /var/lib/dpkg/pck: No such file or directory.

# ls -al /var/cache/apt/. No such file or directory.


Warren Hill (warren-hill) said : #21

This looks interesting. I'll try and dig deeper

try ls -al /var/cache/

should look like this

root@wmh-lt:~# ls -al /var/cache/
total 104
drwxr-xr-x 24 root root 4096 2011-11-15 15:54 .
drwxr-xr-x 14 root root 4096 2011-12-03 22:51 ..
drwxr-xr-x 2 root root 4096 2011-11-15 16:57 anthy
drwxr-xr-x 3 www-data www-data 4096 2010-09-24 14:51 apache2
drwxr-xr-x 2 root root 4096 2010-01-30 09:03 app-install
drwxr-xr-x 4 root root 4096 2011-12-04 11:17 apt
drwxr-xr-x 3 root root 4096 2011-12-04 11:18 apt-xapian-index
drwxrwxr-x 3 root lp 4096 2011-12-04 14:18 cups
drwxr-xr-x 2 root root 4096 2011-11-30 21:51 debconf
drwxr-xr-x 2 root root 4096 2011-11-15 16:57 dictionaries-common
drwxr-xr-x 2 root root 4096 2011-11-15 16:58 flashplugin-installer
drwxr-xr-x 2 root root 12288 2011-11-24 21:29 fontconfig
drwxr-xr-x 2 root root 4096 2009-06-15 11:48 fonts
drwxr-xr-x 3 root root 4096 2010-01-30 09:17 gdm
drwxr-xr-x 2 root root 4096 2011-11-15 16:03 hald
drwxrwsr-t 2 root admin 4096 2011-11-26 09:55 jockey
drwx------ 2 root root 4096 2011-11-30 21:51 ldconfig
drwxr-xr-x 3 root root 4096 2011-11-15 17:14 lightdm
drwxr-sr-x 83 man root 4096 2011-12-04 11:19 man
drwxr-xr-x 2 root root 4096 2010-04-19 11:11 pm-utils
drwxr-xr-x 2 root root 4096 2009-02-20 17:56 pppconfig
drwxr-xr-x 2 root root 4096 2011-12-04 11:00 samba
drwxr-xr-x 3 root root 4096 2011-11-24 21:31 software-center
drwxr-xr-x 3 root root 4096 2010-02-12 20:05 system-tools-backends

let me know what you see here. I would not expect you to have "apache2" unless you are running a web server but I think you should have most if not all the rest

Hello Warren,

I tried ls al /var/cache I retrieved this:

la: cannot access al: No such file or directory, then gave me this:

/var/cache, and highlighted in blue the following:

apt fontconfig lightdm software center
apt-xaplan-index gdm man system-tools-backends
cups Jockey pm-utils
debconf ldconfig pppconfig
dictionaries-common samba

Once again Thank you

Hello Warren,

I also tried:


The following was returned:
Access denied

Also tried

ls al /etc/passwd,shadow

No such file or directory.

Thanks again

Hello Warren

I have good news to announce after one week of surching. Here is the final result

1. Internet connection must be on.
1a. Select Recovery mode.
1b. Mount.
1c. fix bpkg.
2. I visited U-tube some geek showed how to do it.
3. entry as follows:
sudo passwd
enter unix password
re-enter unix password.
password changed successfully
then I typed ls /home
got bach and guest
typed passwd bach
entered unix password
re-entered unix password
password changed successfuully

I hope I will never have to go through this again. The good thing is I have learned something and I am happy about it. I was scared that I was never going to retrieve my files and the priviliges to update.

I hope it will be help to other Ubuntu, Xubuntu users.

Thank you for taking the time to help out. I appreciate the effort.

Have a good holidays to you and your family.