General discussion

Locked

Passwd file - Corrupt

By dallen ·
I have a problem. One of my lower admins messed with the etc/passwd file. In doing so the added the line "/sbin/" after roots login shell. Now we can't use the root account. Bad you have to be root to modify /etc/passwd. But since root is unuasable at the time, I am unable to modify it back. Is there a quick fix out there? Is their a way to ovveride the /etc/passwd file?

Thanks in advance!

-Damon

This conversation is currently closed to new comments.

11 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Passwd file - Corrupt

by Stillatit In reply to Passwd file - Corrupt

It depends on the system, but one of these might work:

Log in as another user.
su
(note - leave out the minus sign you probably normally use with su)

From another computer, as root, try
rsh injuredboxname ksh
If this works, you are executing the korn shell over the link. You will not get a prompt, nor will you have terminal controls, but it should be enough to copy the bad passwd file to somewhere else and put in a temporary dummy one so that you can log in.


From another system, ftp to the injured machine, and log in as root (some systems may not allow this). Grab /etc/passwd. Edit it on your local system, then put it back on the injured box.

If none of these work, let us know the OS type. There are differences betweenAIX/HP-UX/SunOS/Linux etc.

Good luck.

Collapse -

Passwd file - Corrupt

by dallen In reply to Passwd file - Corrupt

Poster rated this answer

Collapse -

Passwd file - Corrupt

by Harold In reply to Passwd file - Corrupt

In case of a linux system you'd reboot in single user mode (at lilo prompt type 'linux single') and then edit the password file.

Collapse -

Passwd file - Corrupt

by dallen In reply to Passwd file - Corrupt

Poster rated this answer

Collapse -

Passwd file - Corrupt

by dallen In reply to Passwd file - Corrupt

Well I am running a RH Linux 7.0 box. I have tried all the ways you suggested put to no avail. Another contributing rason is that he modified the /etc/hosts.conf and put in a DNS line that makes me unable to rsh computername ksh. Man I tell ya, I have just put other root accounts on all my machines, this won't happen again.

Any other suggestions?

Collapse -

Passwd file - Corrupt

by dallen In reply to Passwd file - Corrupt

Poster rated this answer

Collapse -

Passwd file - Corrupt

by zbrain75 In reply to Passwd file - Corrupt

Harold's earlier answer about entering "linux single" on the command line when booting, should have worked.

However, another possible solution (with more work involved) is to create a dual boot linux system, then mount your original system, filesystem from the newly installed system and access your files that way. You can use Partition Magic to create the necessary room on your system to install another Linux system.

If you need information on how to install the second system, then mountthe filesystems, feel free to send an email.

Collapse -

Passwd file - Corrupt

by dallen In reply to Passwd file - Corrupt

Poster rated this answer

Collapse -

Passwd file - Corrupt

by Hasse MCSE/Brainbench In reply to Passwd file - Corrupt

Hi!

If it's a linux system which has / on firs partition on first primary drive do this:

Download Slackware boot & root disks, they are best.

Boot from thoose floppies!

login as root (no password)

if dir /mnt dosen't allready exist do:
mkdir /mnt

now comes the tricky part:
do this:
mount -t ext /dev/hda1 /mnt

if you have another partition for your /usr
you need to mount that partition too:
mount -t ext /dev/hda5 /mnt/usr
or whatever device it is.

Now you can do this:
/mnt/usr/sbin/chroot /mnt /bin/bash

Now you have your real / as /:
Just do:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

and u can use vi to edit /etc/passwd.

when done just reboot and look happy.

If it's anothe Unix than Linux, than you might still be able to use Linux boot disks to recover at least the passwd file since linux can mount at least Solaris partitions.

Hope this helps!

/Hasse

Collapse -

Passwd file - Corrupt

by dallen In reply to Passwd file - Corrupt

Poster rated this answer

Back to Linux Forum
11 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums