reset ubuntu passwords

compnet

New Member
Reaction score
12
This one is killing me.. I've tried everything google has to offer to no avail..

I've tried;

booting to recovery = doesn't work because it has root password
booting to single user (replace ro with rw and add init=/bin/bash on kernel line) = Authentication token manipulation after passwd command and password is unchanged

so reading up on the token error, I tried mount -o, remount, rw / (also added -n) = same token error

Then tried booting from the live cd, and doing chown, and I'm getting the same token error..


The only thing I haven't tried is some googling mention comparing /etc/password and /etc/shadow, but the don't go into any detail of what to compare or how to actually do it..

I'm mostly a linux noob, about to throw in the towel..
 
Boot a livecd or slave the drive to another PC. Find and open /etc/shadow (make a copy first). It will have a list of entries that look something like this:

username:$6$QR3drPrQ$JLolPKyiVuXvea1F2IpbPx9F9PEV0s/IGcNCpm6ZrBA6AFDvwHPQG7EsTQHuUqxfCvlsuKRb.O7w5RLPyj8nS/:15129:0:99999:7:::

The random-looking text between the first and second colons are your password. Find the user you want, then delete the password:

username::15129:0:99999:7:::

Reboot the PC.
 
Boot a livecd or slave the drive to another PC. Find and open /etc/shadow (make a copy first). It will have a list of entries that look something like this:

username:$6$QR3drPrQ$JLolPKyiVuXvea1F2IpbPx9F9PEV0s/IGcNCpm6ZrBA6AFDvwHPQG7EsTQHuUqxfCvlsuKRb.O7w5RLPyj8nS/:15129:0:99999:7:::

The random-looking text between the first and second colons are your password. Find the user you want, then delete the password:

username::15129:0:99999:7:::

Reboot the PC.

Nice tip, thanks for sharing
 
Finally got back around to this one. there are 2 partitions, one has all the system files, the other has all the username folders. on the system partition there is no shadow folder or password folder in the /etc folder.

I'm just gonna give the computer back. I think the user either took measures to prevent normal password resetting procedures from working, or the install is somehow corrupt.. I've spent way too much time on this already.
 
Finally got back around to this one. there are 2 partitions, one has all the system files, the other has all the username folders. on the system partition there is no shadow folder or password folder in the /etc folder.

/etc/passwd (note the spelling) and /etc/shadow are not folders; they are text files. How did you look for the files? Did you boot from a livecd? If so, did you remember to mount the hard drive and look for the files there?
 
/etc/passwd (note the spelling) and /etc/shadow are not folders; they are text files. How did you look for the files? Did you boot from a livecd? If so, did you remember to mount the hard drive and look for the files there?

:facepalm:

Next problem, I don't have permissions to open the shadow file... Also, what would I open them with on an ubuntu live cd?? open office?


edit:
typing mount in terminal give me this for the partition I'm looking at

/dev/sda6 on /media/(hash) type ext2 ( rw,nosuid, no dev,uhelper=udisks)
 
Last edited:
Blank generally means the file does not exist, it creates it, but is not saved unless you actually "save" it.

In /media/(hash)/etc do ls (lowercase L and S) and see if the shadow file is listed.
 
Blank generally means the file does not exist, it creates it, but is not saved unless you actually "save" it.

In /media/(hash)/etc do ls (lowercase L and S) and see if the shadow file is listed.

ah.. yes it is there, there is a dash after it "shadow-"

If I type it with the - it opens up and I can see the users... So do I just make a copy and then delete between the first 2 colons after the username?? Does the - have any significance? And I only have to do this with shadow, not in passwd?
 
Hmmm. /etc/shadow- is a backup; the previous version of the shadow file. The current shadow file should be there without the dash. If the shadow file (without the dash) is not there, you can use a copy of shadow- to replace it. While in the "etc" directory, type:

Code:
cp shadow- shadow

Then, use gedit as noted below to edit the file, removing the random-looking text between the two colons after the username. You don't have to make any changes to the passwd file. Save the file and reboot. You should be able to log in using the user name and no password. Once logged in, you can set a new password using the "passwd" command.
 
Back
Top