[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: I forgot the root password, can not maintain my machine.



Once you have a root shell, why edit /etc/passwd or /etc/shadow at
all?  Why not just use passwd to change the password?

Tom

On  0, Kent West <westk@acu.edu> wrote:
> Bob Proulx wrote:
> 
> >Long Li <lilong76@yahoo.com.cn> [2002-08-03 13:04:21 +0800]:
> > 
> >
> >>>linux init=/bin/bash
> >>>     
> >>>
> >>After I enter linux init=/bin/bash after lilo, I got a
> >>console like this:
> >>
> >>init-2.03#
> >>   
> >>
> >
> >Great!  You are almost there.
> >
> > 
> >
> >>But when I edit the file /etc/passwd, systme told me:
> >>
> >>init-2.03# ed /etc/passwd
> >>Read-only file system.
> >>
> >>So I can not modify that file.  How can edit that
> >>file?
> >>   
> >>
> >
> >Normally at boot time the filesystem is mounted readonly just before
> >doing a file system check.  If that passes as it will normally then
> >the system is remounted in a read-write state.  You need to mount it
> >in a read-write state.  I think you can just run:
> >
> > mount -n -o remount,rw /  
> >
> >That will mount it readwrite and you will be able to edit the password
> >file.
> >
> >Bob
> > 
> >
> I just read another source on this; it said to not edit /etc/passwd if 
> you're using shadow passwords (if there's an "x" in the second field of 
> /etc/passwd). In stead, you should edit /etc/shadow and blank out the 
> second field in that file. Now that I remember the one time that I had 
> to do this several years ago, that sounds right.
> 
> Kent
> 
> 
> 
> 

-- 

Attachment: pgpeF3ABHKtxh.pgp
Description: PGP signature


Reply to: