how to retrieve root paswd

Hi..frnds..

I am a newcomer in the world of unix......i want to know if by smhow smone forget the root passwd is there any way to get it back....login as a odd user other than root..

please give suggession....

Thanks and regards.
praful:)

Well, assuming you're doing it lawfully, you should have access to the machine. If you are running Linux, head on over to tomsrtbt home page and grab tomsrtbt to boot into your system from a floppy. If you are running some other hardware/software combination than Linux on Intel, check your documentation for details on booting into mini-root. Mount the partition / disk that contains the /etc directory, and you'll have to edit the passwd (or shadow, if you're using shadowed passwords) file. Clear out the password field for root, so it should look like this:

root::0:0::/:/sbin/sh
instead of
root:/z4qjkR6ptOeEOvY:0:0::/:/sbin/sh
[Note: that is a munged passwd - don't waste your time trying to crack it. I just made it up. A normal password field would have 13 characters, and MD5 passwords have many more.]

Now, boot the system normally. You should be able to log in as root (or use su - ) without a password. Now make sure to set a good, rememberable (no, I don't think that's a work either) password!

You can also delegate root privelages to other accounts by editing the passwd file, but that's not always a good idea - especially on a production system.

HTH

Thanks HTH..

I will try with this......

:slight_smile:

Well with Linux this could be even easier:

at LILO prompt (or boot prompt) :
type linux -s or linux 1 or linux single

This will drop you into a root shell without asking a password.

When the bash# prompt appears, enter:
passwd

This will prompt you for a new root password, without asking the old one!

I've had a problem in the past of a user coming into the office, rebooting the server and booting in single user mode and then changing the passwd.

How do I restrict booting into single user mode?

Thanks in advance.

VJ

You _can_ stop people playing with your server totally, if you know how to do it... here are some instructions :

1)Disable all boot devices except harddisk in BIOS
2)Password BIOS
3)vi /etc/lilo.conf

add 'restricted=' option (look at man lilo.conf for more details)
add 'password=' option (again its in the man pages)

run lilo to apply changes

essentially you can restrict command line input (hence getting round the linux single problem, and you can also password the command the user wants to run (hence you can still do single if you know the password) Just make sure the default image is still bootable without user input, otherwise if it gets rebooted it'll stop at lilo.

Be careful with this, if the system screws and you cant get in you'll need to sort the BIOS and boot off floppy, then manually run lilo on the volume.

Any problems or further queries, drop me a mail

I'm glad to get that information.

Regards,

VJ

Of course this is a good discussion for this particular forum. I really like mibs suggestion on on the lilo prompt (linux -s) and miket2001 on more lilo magic.

another way of doing it with lilo for linux is to pass init= to the kernel, like
linux init=/bin/sh or whatever,
HTH Jan