Jump to content

Passwords screwed [solved]


Recommended Posts

Slight problem :P

 

Been following some documents in preparation for a course, and I've been following this:

 

Use vi to edit /etc/passwd and create a new user. I used yy to copy the line, p to paste and then changed the values for the new user.

 

It then said use passwd username to change the password. So I did this, but it was failing with authentication token problem. I tracked this down to being because of shadow passwords. I removed /etc/shadow, and then used pwconv to create a new shadow file. I then set the password to my user. I disconnected from the system, but now I find I cannot connect as my admin user or even root.

 

Any ideas on how I can get back in? Oh, no rescue disk before you ask. Running Red Hat Linux.

Link to comment
Share on other sites

purist

boot into single usermode from grub/lilo

 

Its either

<kernelimage> 1

or

<kernelimage> -1

 

I think the former....

This should get you to the RL 1 where removing the xxx part of /etc/password should remove the need for one and then pwconv should create a skeleton shadow file

 

simple

boot up with a bootable distro and copy the known root password hash into the shadow file

 

 

I haven't tried these for obvious reasons and I know you know what your doing so give this a try but if you are desperate post back and I can clone a vmware session and wreck it if you need :D

Link to comment
Share on other sites

I did it :P

 

First I thought change the "x" following the username to password, and then I rebooted without creating the shadow file. This obviously failed. The second time I decided to remove and leave it blank, and then created the shadow file, and managed to get in. I then issued the passwd command to reset for the relative users, and then checked /etc/shadow to make sure they'd been updated.

 

Didn't think of copying the files from one to another. All the other users are whatever the default is, so not sure, but everything seems to be working. Next time I'll make sure I copy the files as backups before I do anything like this again!!!

 

Many thanks for the other methods Gowator, I can bear these in mind should I do it again :D

Link to comment
Share on other sites

Something I do on a regular basis is create a gzipped tar on a seperate drive (my home) which contains /etc and often digs me outa lots of messes ...

However vmware sessions are great for what you are doing ... you can copy the whole lot and restore it without hassle as a snapshot and if someone creates the session for you you don't even need the full product, just the free player ...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...