how to change root passwd (if forgotten)

Support for security such as Firewalls and securing linux
Post Reply
abd_bela
Posts: 2
Joined: 2011/08/10 15:33:13

how to change root passwd (if forgotten)

Post by abd_bela » 2011/08/10 15:40:11

Hi,
I ve forgotten my root passwd on centos 6,

I tried to change it as I used in debian (in debian it works perfectly) , that is:

use a cd live (or installation cd1), to access the hd,
I mount my root partition and mount proc and devices

I tried the command passwd, no error reprorted, but after reboot the passwd had´t changed.
then I decided to remove passwd from /etc/shadow (delete the
second field).

OK, now I can access my machine without passwd, BUT I CAN´T GIVE ANY PASSWORD!!!! I RECEIVE THIS ERROR

# passwd
Changing password for user root.
New password:
Retype new password:
passwd: Authentication token manipulation error

any idea to fix the problem.

hawaiian717
Posts: 178
Joined: 2009/01/30 19:58:25
Location: California

Re: how to change root passwd (if forgotten)

Post by hawaiian717 » 2011/08/10 15:45:29

Boot into Single User Mode. This bypasses login and goes directly to a root prompt. Then use the passwd command to change the root password. However I'm not sure if this will work correctly after you changed your /etc/shadow file.

foxb
Posts: 1921
Joined: 2006/04/20 19:03:33
Location: Montreal/QC

how to change root passwd (if forgotten)

Post by foxb » 2011/08/11 14:00:28

If single user mode does not work

Boot with live cd and fix you shadow file (copy known password hash)

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: how to change root passwd (if forgotten)

Post by pschaff » 2011/08/13 12:40:33

See [url=http://wiki.centos.org/TipsAndTricks/ResetRootPassword]TipsAndTricks/ResetRootPassword[/url] and in particular the CentOS-6 note at the end.

Post Reply