Unix Technical Forum

root password problem

This is a discussion on root password problem within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Hi, I installed Slack 12.0 but somehow mistyped the root password. I can get in using "linux init=/bin/bash" but ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 04:33 AM
Huub
 
Posts: n/a
Default root password problem

Hi,

I installed Slack 12.0 but somehow mistyped the root password. I can get
in using "linux init=/bin/bash" but can't find the passwd command. I
also went in by booting from CD and using "mount /dev/sda1 /mnt", but
changing either /etc/passwd and /etc/shadow doesn't erase the root
password either. So, before reinstalling Slack, does someone have
another way to reset it?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 04:33 AM
Olive
 
Posts: n/a
Default Re: root password problem

Huub wrote:
> Hi,
>
> I installed Slack 12.0 but somehow mistyped the root password. I can get
> in using "linux init=/bin/bash" but can't find the passwd command. I
> also went in by booting from CD and using "mount /dev/sda1 /mnt", but
> changing either /etc/passwd and /etc/shadow doesn't erase the root
> password either. So, before reinstalling Slack, does someone have
> another way to reset it?


If you boot with init=/bin/bash; you are read only; you have to remount
/ read-write:
mount -o remount rw /
passwd
and unmount it before rebooting
umount /

I am not currently in Slackware so I can't tell wher eexactly is the
passwd command; but it should not be difficult to find: /usr/bin/passwd;
/usr/sbin/passwd; /sbin/passwd or something like.

To erase the root passwd by hand (from a bootable CD); find /etc/shadow
(not /etc/passwd) and erase the second field of the root entry; you must
then have something like:

root::13691:0:99999:7:::


>
> Thanks.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 04:33 AM
Henrik Carlqvist
 
Posts: n/a
Default Re: root password problem

Huub <"v.niekerk at hccnet.nl"> wrote:
> I installed Slack 12.0 but somehow mistyped the root password.


> I also went in by booting from CD and using "mount /dev/sda1 /mnt", but
> changing either /etc/passwd and /etc/shadow doesn't erase the root
> password either.


You will have to reset the password in /mnt/etc/shadow. Remove all the
characthers between the two colons for the password column so the root row
looks something like this:

root::11690:0:::::

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc1(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 04:33 AM
loki harfagr
 
Posts: n/a
Default Re: root password problem

On Sat, 18 Aug 2007 11:09:50 +0200, Huub wrote:

> Hi,
>
> I installed Slack 12.0 but somehow mistyped the root password. I can get
> in using "linux init=/bin/bash" but can't find the passwd command. I
> also went in by booting from CD and using "mount /dev/sda1 /mnt", but
> changing either /etc/passwd and /etc/shadow doesn't erase the root
> password either. So, before reinstalling Slack, does someone have
> another way to reset it?


The two methods are good, also can use at boot prompt one
of the variations on 'linux single' 'linux rescue', the
/bin/bash is much faster :-)

I think you forgot to chroot the "real" / or to mount it readwrite ?

mount -o remount,rw /

or:

mount -o remount,rw /dev/yourslashdotpartition

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2008, 04:33 AM
Huub
 
Posts: n/a
Default Re: root password problem

> The two methods are good, also can use at boot prompt one
> of the variations on 'linux single' 'linux rescue', the
> /bin/bash is much faster :-)
>
> I think you forgot to chroot the "real" / or to mount it readwrite ?
>
> mount -o remount,rw /
>
> or:
>
> mount -o remount,rw /dev/yourslashdotpartition
>


I must have forgotten to install some packages, because passwd wasn't
there. Editing /etc/shadow didn't help either. Reinstalling from scratch
now. Thanks for helping.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-21-2008, 04:33 AM
loki harfagr
 
Posts: n/a
Default Re: root password problem

On Sat, 18 Aug 2007 15:12:59 +0200, Huub wrote:

>> The two methods are good, also can use at boot prompt one of the
>> variations on 'linux single' 'linux rescue', the /bin/bash is much
>> faster :-)
>>
>> I think you forgot to chroot the "real" / or to mount it readwrite ?
>>
>> mount -o remount,rw /
>>
>> or:
>>
>> mount -o remount,rw /dev/yourslashdotpartition
>>
>>

> I must have forgotten to install some packages, because passwd wasn't
> there.


That's very strange indeed, I believe the 'passwd' is in the
..../a/shadow*.tgz package, as it's the one that also
provides 'login' you should have had other problems first!

More probably some tool or friend or finger was involved in the
disparition of 'passwd', might be to investigate :-)

> Editing /etc/shadow didn't help either. Reinstalling from scratch
> now. Thanks for helping.


OK, all's fine now then? Good luck!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-21-2008, 04:33 AM
Eef Hartman
 
Posts: n/a
Default Re: root password problem

Huub <"v.niekerk at hccnet.nl"> wrote:
> I installed Slack 12.0 but somehow mistyped the root password. I can get
> in using "linux init=/bin/bash" but can't find the passwd command.


It is (or should be) /usr/bin/passwd (and it should come with the
"shadow" package).

> also went in by booting from CD and using "mount /dev/sda1 /mnt", but
> changing either /etc/passwd and /etc/shadow doesn't erase the root


Of course, with your hard disk mounted at "/mnt" the shadow file is
at "/mnt/etc/shadow", the one YOU erased is the one in the RAM-disk,
installed by the CD-rom boot system.
Just emptying the password field for "root" in that file
(/mnt/etc/shadow, it should be the 2nd field, between the first and
second : character) should wipe out the password for root.
--
************************************************** ******************
** Eef Hartman, Delft University of Technology, dept. EWI/TW **
** e-mail: E.J.M.Hartman@math.tudelft.nl, fax: +31-15-278 7295 **
** snail-mail: P.O. Box 5031, 2600 GA Delft, The Netherlands **
************************************************** ******************
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-21-2008, 04:33 AM
Huub
 
Posts: n/a
Default Re: root password problem

> It is (or should be) /usr/bin/passwd (and it should come with the
> "shadow" package).


That was the odd thing: /usr/bin wasn't there...

> Of course, with your hard disk mounted at "/mnt" the shadow file is
> at "/mnt/etc/shadow", the one YOU erased is the one in the RAM-disk,
> installed by the CD-rom boot system.
> Just emptying the password field for "root" in that file
> (/mnt/etc/shadow, it should be the 2nd field, between the first and
> second : character) should wipe out the password for root.


Ok,...got it now. BTW, had to even repartition since I got "no space
left on device". Booting smoothly now...root and user set ok.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-21-2008, 04:33 AM
Eef Hartman
 
Posts: n/a
Default Re: root password problem

Huub <"v.niekerk at hccnet.nl"> wrote:
>> It is (or should be) /usr/bin/passwd (and it should come with the
>> "shadow" package).

>
> That was the odd thing: /usr/bin wasn't there...


Maybe /usr is a separate mounted filesystem in your PC?
Then, of course, it doesn't get mounted with your mount of the
hard disk at /mnt (and even when it is not, WITH the harddisk mounted
onto a ram-disk system, the command is /mnt/usr/bin/passwd).

When you boot with a "root=" option, the _real Harddisk_ should be
mounted in its normale place (as /), so THEN it is /usr/bin/passwd
again.
--
************************************************** ******************
** Eef Hartman, Delft University of Technology, dept. EWI/TW **
** e-mail: E.J.M.Hartman@math.tudelft.nl, fax: +31-15-278 7295 **
** snail-mail: P.O. Box 5031, 2600 GA Delft, The Netherlands **
************************************************** ******************
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-21-2008, 04:33 AM
Kees Theunissen
 
Posts: n/a
Default Re: root password problem

Eef Hartman wrote:

> When you boot with a "root=" option, the _real Harddisk_ should be
> mounted in its normale place (as /), so THEN it is /usr/bin/passwd
> again.


But THEN the _real /etc/shadow_ would be used to verify the password
during logon. And Huub started this thread because he mistyped the
root password during installation and he is denied root access in
the normal way.

Regards,

Kees.

--
Kees Theunissen.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:53 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com