Deleted /etc/passwd file while accessing to our test server via putty


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Deleted /etc/passwd file while accessing to our test server via putty
# 1  
Old 06-22-2013
Deleted /etc/passwd file while accessing to our test server via putty

Hi

I was accessing our linux test server via putty and By mistake i deleted /etc/passwd file.....

It is allowing me to login..... So could anyone please help me out in this issue....

Please, it is urgent
# 2  
Old 06-22-2013
Restore from backup, or copy over from a machine with an identical account layout.
# 3  
Old 06-22-2013
Quote:
Originally Posted by rahul547
Hi

I was accessing our linux test server via putty and By mistake i deleted /etc/passwd file.....

It is allowing me to login..... So could anyone please help me out in this issue....

Please, it is urgent
It is allowing you to login or NOT allowing you to login? - I assume it is NOT allowing you to login.
Here's what I would do. Login to another computer (preferably same Linux distro/version) and copy
the line of that system's /etc/passwd file where it specifies the password for root. In my system it is:
Code:
root:x:0:0:root:/root:/bin/bash

Then paste it into your test server's /etc/passwd file.
Same thing with /etc/shadow:
Code:
root:$longjumbleofstuff:15797:0:99999:7:::

Moderator's Comments:
Mod Comment Posting lines from your /etc/shadow exposes your password to cracking, they should be posted obscured.

Of course, you will have to do this with a LiveCD. Knoppix is an excellent choice if you ask me.
Please note that unless you have really messed things up, the /etc/shadow file must exist in your test server. You will have to edit it with root's encrypted password that you have copied from the other working computer.
You can also take a look at the following pages:
linux admin: Recovery of deleted /etc/passwd File in Linux
Recover deleted /etc/passwd File In RHEL | For Some Cool Tips By VINY
Hacking Root Password In Linux | For Some Cool Tips By VINY
Good luck!
Let us know how everything goes Smilie.

Last edited by Corona688; 06-22-2013 at 03:10 PM..
# 4  
Old 06-23-2013
Unless you can restore that file from a backup, your accident won't go unnoticed. You can start off with the usernames from /etc/shadow and rebuild /etc/passwd, but e.g. non-standard login shells and user homes will be lost. You might be lucky in that passwords are stored in /etc/shadow.
# 5  
Old 06-23-2013
Moderator's Comments:
Mod Comment Posting lines from your /etc/shadow exposes your password to cracking, they should be posted obscured.

Thanks! I actually thought about that and changed several characters in the password field. But now that you mentioned it, how do I post something 'obscured'?
# 6  
Old 06-23-2013
e.g. by replacing the encrypted password by the string "obscured" (or "xxxxxxx" or...).
# 7  
Old 06-24-2013
Quote:
Originally Posted by gacanepa
Thanks! I actually thought about that and changed several characters in the password field.
Ah, good. I couldn't have known that unfortunately Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Deleted known_hosts file on private server, how do I get it back?

In my ignorance I deleted the known_hosts file on private server. I am not sure what the file type is supposed to be. In general, I have been having problems with ssh and passwords. For some reason, despite having generated a private/public key pair and successfully saving the .pub file onto the... (2 Replies)
Discussion started by: Circuits
2 Replies

2. UNIX and Linux Applications

Logging to server to get etc/passwd file of all 300 server

i am new to scripting ,i need bash script in jump server to pull the /etc/passwd of all servers and the ssh keys are installed (3 Replies)
Discussion started by: profiles
3 Replies

3. Solaris

How to run putty.exe file in server?

Hi, I want to run putty.exe in Solaris server.My main aim is to invoke the putty.exe in Solaris server from a web application(.jsp) deployed in the server so that putty terminal should open. Thanks in advance (11 Replies)
Discussion started by: chaithanyaa
11 Replies

4. Proxy Server

Upload file from desktop to UNIX server via putty

I have a requirement of following - 1. Transfer excel spreadsheet from desktop to unix server 2. Open the spreadsheet and read the sql row by row at a time 3. Run each sql on database using unix and then send output back to spreadsheet that was uploaded earlier and then transfer file back to... (12 Replies)
Discussion started by: Analabhatla
12 Replies

5. Solaris

Passwd,shadow files deleted and abort sequence disabled

Hi all.. I moved the /etc/shadow and /etc/shadow files to /tmp and then rebooted my PARC machine running 5.10. I did it to see if I could recover from single user mode. But, I forgot to enable the abort key-sequence which I earlier disabled. Stuck! One of my gurus told I had to... (9 Replies)
Discussion started by: satish51392111
9 Replies

6. AIX

-805 error in AIX UNIX accessing TEST DB from PROD

Hi, I am getting -805 error when i tried accessing TEST DB from PROD environment in AIX UNIX. Could anyone help me in this regard. Thx, Satish (1 Reply)
Discussion started by: satishstar2
1 Replies

7. Linux

how to get passwd command again if it is deleted by usin rm command

hai friends i have deleted passwd command using rm command i thought it will come again at the time of rebooting but it is completely deleted how to get it worked again (5 Replies)
Discussion started by: venkata.ganesh
5 Replies

8. Solaris

/etc/passwd file been deleted

Hi Folks , Would be grateful if someone could help me out in one of the question that came to my mind . If the /etc/passwd file has been deleted and the system has been rebooted . Then i dont think that any user would be able to login and the system will be useless . Whats the best solution for... (5 Replies)
Discussion started by: gera_sachin125
5 Replies

9. UNIX for Dummies Questions & Answers

Deleted /etc/passwd

Hi all, While playing with my LINUX machine i accidently deleted a file name called /etc/passwd . Even though the system is booted am unable to get the login prompt. Is there any remedy for this problem.:( (5 Replies)
Discussion started by: cyno
5 Replies
Login or Register to Ask a Question