Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to change root passwd (if forgotten)

69 views
Skip to first unread message

abdelkader belahcene

unread,
Aug 10, 2011, 11:50:02 AM8/10/11
to
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

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

Umarzuki Mochlis

unread,
Aug 10, 2011, 12:00:01 PM8/10/11
to
if i'm not mistaken you can just go to single user mode on centos by appending "1" or "single" (without quotes) on boot parameter, no need for any live cd

2011/8/10 abdelkader belahcene <abela...@gmail.com>



--
Regards,

Umarzuki Mochlis
http://debmal.my

Thierry Chatelet

unread,
Aug 10, 2011, 12:10:02 PM8/10/11
to
On Wednesday 10 August 2011 17:53:26 Umarzuki Mochlis wrote:
> if i'm not mistaken you can just go to single user mode on centos by
> appending "1" or "single" (without quotes) on boot parameter, no need for
> any live cd
>

Not with debian, but lots of trail if you google it.
Thierry


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: http://lists.debian.org/201108101801.4...@free.fr

Aniruddha

unread,
Aug 10, 2011, 1:50:02 PM8/10/11
to
On Wed, Aug 10, 2011 at 5:25 PM, abdelkader belahcene
<abela...@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:
...

>
> any idea to fix the problem.
> thanks a lot
>
http://www.centos.org/docs/5/html/Installation_Guide-en-US/ch-rescuemode.html


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/CAMpSvvyX37XFzY4DyScmZsZr...@mail.gmail.com

shawn wilson

unread,
Aug 10, 2011, 2:20:02 PM8/10/11
to
you forgot chroot. might also need to do ldconfig -v to make sure the path to shared libraries is correct (but i don't think so).

you used to be able to clear out the field in the shadow file or clear out the x (iirc) in passwd, but i think default pam will stop you from doing this :)

Ivan Shmakov

unread,
Aug 10, 2011, 2:20:02 PM8/10/11
to
>>>>> abdelkader belahcene <abela...@gmail.com> writes:

[…]

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

Running pwck(8) may give one more information on the issue.

Then, I'd make a backup for shadow(5) and try to use pwconv(8)
to fix the inconsistencies reported by pwck(8).

> thanks a lot *

--
FSF associate member #7257


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/86y5z1b...@gray.siamics.net

abdelkader belahcene

unread,
Aug 10, 2011, 8:00:01 PM8/10/11
to
On 8/10/11, Lucas Lima <lcs.fre...@gmail.com> wrote:
> the passwords are stored in /etc/shadow and you deleted the file, you should
> restore it.
I just removed the second field , the password for th root. no more things

restore it ?? how??


starting with level 1, (single ) is not a solution, the password is required.

regards


> And to set a new root password read more, its quite easy
>
> 2011/8/10 abdelkader belahcene <abela...@gmail.com>
>
>> *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
>>
>> 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 *
>>
>


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/CAF3f0sQ9v-JeSsLULzXQZ-YR...@mail.gmail.com

Francois Cerbelle

unread,
Aug 11, 2011, 3:40:01 AM8/11/11
to
Le Wed, 10 Aug 2011 18:10:02 +0200, Thierry Chatelet a écrit :
> On Wednesday 10 August 2011 17:53:26 Umarzuki Mochlis wrote:
>> if i'm not mistaken you can just go to single user mode on centos by
>> appending "1" or "single" (without quotes) on boot parameter, no need
>> for any live cd
>>
> Not with debian, but lots of trail if you google it. Thierry

But "init=/sbin/bash" should work, then mount, modify, dont forget to
umount everything and reboot

--
Francois


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/4e43814f$0$16474$426a...@news.free.fr

Ivan Shmakov

unread,
Aug 11, 2011, 6:00:02 AM8/11/11
to
>>>>> Francois Cerbelle <fran...@cerbelle.net> writes:
>>>>> Le Wed, 10 Aug 2011 18:10:02 +0200, Thierry Chatelet a écrit:
>>>>> On Wednesday 10 August 2011 17:53:26 Umarzuki Mochlis wrote:

>>> if i'm not mistaken you can just go to single user mode on centos
>>> by appending "1" or "single" (without quotes) on boot parameter, no
>>> need for any live cd

>> Not with debian, but lots of trail if you google it.

> But "init=/sbin/bash" should work, then mount, modify, dont forget to
> umount everything and reboot

Instead of rebooting, one may exec the proper init(8) here,
like:

# exec /sbin/init

--
FSF associate member #7257

--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/86k4akb...@gray.siamics.net

Wawrzek Niewodniczanski

unread,
Aug 11, 2011, 8:40:02 AM8/11/11
to
On 08/11/11 00:35, abdelkader belahcene wrote:
On 8/10/11, Lucas Lima <lcs.fre...@gmail.com> wrote:
the passwords are stored in /etc/shadow and you deleted the file, you should
restore it.
I just removed the second field , the password for th root. no more things

You can copy a password from other user or even from other machine.

Wawrzek

--
Wawrzyniec (Wawrzek) Niewodniczański - (niewod @ LinkedIn)
System Administrator - Engineering Services Team (XenServer)
Citrix Systems, Building 101, Cambridge Science Park, CB4 0FY, Cambridge
PhD in Quantum Chemistry, MSc in Molecular EngineeringM

Nico Kadel-Garcia

unread,
Aug 11, 2011, 10:30:03 AM8/11/11
to
On Wed, Aug 10, 2011 at 11:25 AM, abdelkader belahcene
<abela...@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
>

--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/CAOCN9rwfnVVgRS7C3ZCYaSk-...@mail.gmail.com

Robert Blair Mason Jr.

unread,
Aug 11, 2011, 1:10:02 PM8/11/11
to
On Thu, 11 Aug 2011 07:14:23 +0000 (GMT)
Francois Cerbelle <fran...@cerbelle.net> wrote:

> Le Wed, 10 Aug 2011 18:10:02 +0200, Thierry Chatelet a écrit :
> > On Wednesday 10 August 2011 17:53:26 Umarzuki Mochlis wrote:
> >> if i'm not mistaken you can just go to single user mode on centos
> >> by appending "1" or "single" (without quotes) on boot parameter,
> >> no need for any live cd
> >>
> > Not with debian, but lots of trail if you google it. Thierry
>
> But "init=/sbin/bash" should work, then mount, modify, dont forget to
> umount everything and reboot
>

You mean init=/bin/bash right?

and you'll probably have to mount -o remount,rw / before you passwd.

--
rbmj


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/20110811105...@blairasus.mason.homeunix.org

Walter Hurry

unread,
Aug 11, 2011, 2:50:02 PM8/11/11
to

All the responses (except one) have me mystified. Why can't OP just boot
into single user mode?

--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/j2181p$mlt$1...@dough.gmane.org

Dom

unread,
Aug 11, 2011, 3:30:02 PM8/11/11
to
On 11/08/11 19:46, Walter Hurry wrote:
> On Thu, 11 Aug 2011 10:23:17 -0400, Nico Kadel-Garcia wrote:
>
>> On Wed, Aug 10, 2011 at 11:25 AM, abdelkader belahcene
>> <abela...@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:
>>>
(snippage)

>
> All the responses (except one) have me mystified. Why can't OP just boot
> into single user mode?

Because you need the root password to enter single user mode?

--
Dom


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/4E442D6...@rpdom.net

Walter Hurry

unread,
Aug 11, 2011, 5:40:02 PM8/11/11
to
On Thu, 11 Aug 2011 20:28:33 +0100, Dom wrote:

> On 11/08/11 19:46, Walter Hurry wrote:
>> On Thu, 11 Aug 2011 10:23:17 -0400, Nico Kadel-Garcia wrote:
>>
>>> On Wed, Aug 10, 2011 at 11:25 AM, abdelkader belahcene
>>> <abela...@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:
>>>>
> (snippage)
>>
>> All the responses (except one) have me mystified. Why can't OP just
>> boot into single user mode?
>
> Because you need the root password to enter single user mode?

Not in RHEL and clones.

--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/j21hts$l5i$1...@dough.gmane.org

Aaron Toponce

unread,
Aug 11, 2011, 5:50:02 PM8/11/11
to
On Thu, Aug 11, 2011 at 08:28:33PM +0100, Dom wrote:
> On 11/08/11 19:46, Walter Hurry wrote:
> >On Thu, 11 Aug 2011 10:23:17 -0400, Nico Kadel-Garcia wrote:
> >
> >>On Wed, Aug 10, 2011 at 11:25 AM, abdelkader belahcene
> >><abela...@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:
> >>>
> (snippage)
> >
> >All the responses (except one) have me mystified. Why can't OP just boot
> >into single user mode?
>
> Because you need the root password to enter single user mode?

sulogin is easy enough to bypass.

* Boot Live CD
* Mount /
* Edit /etc/inittab
* Comment out si::sysinit:/etc/init.d/rcS
* Reboot into single user mode

Much easer than chroots, or any of the other previous suggestion, IMO.

--
. o . o . o . . o o . . . o .
. . o . o o o . o . o o . . o
o o o . o . . o o o o . o o o

signature.asc

Aaron Toponce

unread,
Aug 11, 2011, 6:00:01 PM8/11/11
to
On Thu, Aug 11, 2011 at 03:48:02PM -0600, Aaron Toponce wrote:
> * Comment out si::sysinit:/etc/init.d/rcS

Meh. Wrong copy/paste. Comment out: ~~:S:wait:/sbin/sulogin

signature.asc

Robert Blair Mason Jr.

unread,
Aug 11, 2011, 11:50:01 PM8/11/11
to
On Thu, 11 Aug 2011 15:48:02 -0600
Aaron Toponce <aaron....@gmail.com> wrote:
>
> sulogin is easy enough to bypass.
>
> * Boot Live CD
> * Mount /
> * Edit /etc/inittab
> * Comment out si::sysinit:/etc/init.d/rcS
> * Reboot into single user mode
>
> Much easer than chroots, or any of the other previous suggestion, IMO.
>

Easier than:

* Add init=/bin/bash to the end of kernel in grub
* mount -o remount,rw /
* passwd
* sync & reboot

? Most people I know would rather blindly type commands than edit a
file, and I for one lose my Live CDs a lot :D

--
rbmj


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/20110811224...@blairasus.mason.homeunix.org

Ivan Shmakov

unread,
Aug 12, 2011, 12:10:01 AM8/12/11
to
>>>>> Robert Blair Mason <rb...@verizon.net> writes:
>>>>> On Thu, 11 Aug 2011 15:48:02 -0600

>> sulogin is easy enough to bypass.

>> * Boot Live CD
>> * Mount /
>> * Edit /etc/inittab
>> * Comment out si::sysinit:/etc/init.d/rcS
>> * Reboot into single user mode

>> Much easer than chroots, or any of the other previous suggestion, IMO.

> Easier than:

> * Add init=/bin/bash to the end of kernel in grub
> * mount -o remount,rw /
> * passwd
> * sync & reboot

I'd rather recommend # umount -a instead of # sync here.

Then, to my experience, # exec /sbin/init is by no way inferior
to # reboot.

> ? Most people I know would rather blindly type commands than edit a
> file, and I for one lose my Live CDs a lot :D

--
FSF associate member #7257


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Archive: http://lists.debian.org/86sjp79...@gray.siamics.net

0 new messages