Re: how to change root passwd (if forgotten)
On Wed, Aug 10, 2011 at 11:25 AM, abdelkader belahcene
<abelahcene@gmail.com> wrote:
> Hi,
> I ve forgotten my root passwd on centos 6 (red hat based),
>
> 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
Definitely the wrong newsgroup, but:
* boot with CentOS, RHEL, or Scientific Linux rescue CD
* Select "linux rescue" or rescue mode from the CD boot process.
* Allow it to mount your old system at /mnt/sysimage with all
the relevant /dev and /dev/sys utilities under it.
* Do "chroot /mnt/sysimage" to enter the environment of the
mounted directories, in a chroot cage.
* THEN do "passwd root"
* Exit the chroot. (Just type "exit").
* Sync the disk changes, just as a precaution. (Just type "sync")
* Reboot and eject CD.
I generally setup PXE to make these tools available without a CD in
large environments,. The "chroot" business is core to updating messed
up grub configurations, password files, kernels, fstab, or core system
libraries.
> 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.
> thanks a lot
>
Reply to: