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

Re: Messed up root



Hi

On Tue, Nov 27, 2012 at 12:43:29AM +0000, Gary Roach wrote:
> I've done the unthinkable. I accidentally changed root to qroot in my 
> /etc/passwd file and then proceeded to log out of root. All of the files 
> in /etc were changed to owner qroot and the root password doesn't work 
> any more. I have a new Knoppix CD and a new Debian network install CD. 
> Can I use either of these to edit the passwd file and correct the 
> problem. If so, how.

Easy. At the grub boot prompt, edit the kernel command line and add:

      init=/bin/bash

This will start "/bin/bash" instead of the normal init scripts. Once
you get a shell prompt, beware that no daemons will be running, and
you only have the root file system available in read-only mode.

If you have /usr on a separate file system, then you probably want to:

   # mount /usr

and then you can edit the password file:

   # mount -oremount,rw /
   # vi /etc/passwd

(You don't have to use vi - any text editor will do. But do not expect
a graphical one to work.)

Once done, umount things:

   # umount /usr  # if /usr is a separate file system
   # mount -oremount,ro /
   # sync
   # reboot -fn

Hope this helps

-- 
Karl E. Jorgensen


Reply to: