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


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Deleted known_hosts file on private server, how do I get it back?
# 1  
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 private server @ ~/.ssh I am still being prompted for passwords. That is what lead me to deleting the contents of the directory and trying to start over.
# 2  
If not knowing the host (which identifies itself with some sort of key similar to the ssh key during login negotiation), the client informs you accordingly and asks you if you really want to continue / connect. You say "yes", the client stores the key, and knows the host the next time you connect.
This User Gave Thanks to RudiC For This Post:
# 3  
Hi,

Quote:
Deleted known_hosts file on private server, how do I get it back?
The obvious answer is: Restore it from your backup. If you do not have one, or realize that your backup does not allow restoration, that may be a serious problem.

The file known_hosts does not really have to do with authentication. You may use ssh-keyscan to gather the keys from different hosts, or just initiate an ssh command to that host, like RudiC said. You may temporarily ignore the host-keys with an ssh command like this:

Code:
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ...

Authentication is described within the OpenSSH manpages. See here for details:

OpenSSH: Manual Pages

Check especially the AUTHENTICATION and FILES sections in ssh(1) command there for general descriptions and required file permissions. As reading this there, I would advise that all "recommended file settings" there are strictly done that way. I'm not sure that this wouldn't cause errors if not done so.

Last edited by stomp; 05-12-2019 at 08:31 AM..
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #245
Difficulty: Easy
In 1971, Ray Tomlinson, of BBN sent the first network e-mail.
True or False?

9 More Discussions You Might Find Interesting

1. Linux

Recover deleted files on Linux server

Hi Guys, Greetings!. I have executed the cronjob that runs the shell script which is in directory.When the cronjob was executed , I found that the directory where the script resides has got deleted. Note: The directory was deleted with other use not root user. The... (9 Replies)
Discussion started by: reminisce
9 Replies

2. Shell Programming and Scripting

Files not deleted in source server

I have connected to the source server by ftp command. when I tried to delete the file I am getting the permission error. delete file1.txt 450 No permission to delete /today1/file1.txt the files have below permission 150 File status okay; about to open data connection. drwx------ 0 ... (3 Replies)
Discussion started by: ramkumar15
3 Replies

3. UNIX for Advanced & Expert Users

How to check or remove IP address from a hashed known_hosts file?which

Hi, In my server, the hostname and IP addresses are added to the known_hosts which then be hashed by ssh-keygen -H -f. Is it possible to check if an IP address has already been added to the hashed known_hosts to avoid duplications (I think there will be problems if there are duplicated IP... (3 Replies)
Discussion started by: hce
3 Replies

4. UNIX for Dummies Questions & Answers

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 (6 Replies)
Discussion started by: rahul547
6 Replies

5. UNIX for Dummies Questions & Answers

Solaris and known_hosts

Hello, I have a file known_hosts where i want to remove a key, but i don't how to do remove a client on it ? Can you help me please ? Thanks very much (1 Reply)
Discussion started by: jose2204
1 Replies

6. Solaris

ssh private keys stored on home server

Where in the world are the ssh private keys stored on the home server? I know the public keys are renamed to authorized_keys under the /export/home//.ssh directory on the remote server. (1 Reply)
Discussion started by: jastanle84
1 Replies

7. Linux

Bring back a deleted partition

I deleted my partition on a test server and want to bring back the partition. I have not rebooted yet, so system is operational. I have the /proc/partition major minor #blocks name 8 0 195359960 sda 8 1 1044224 sda1 8 ... (2 Replies)
Discussion started by: photon
2 Replies

8. UNIX for Dummies Questions & Answers

Restoring back a deleted file in unix.

Hi, Can any one tell me how to restore back the deleted file in unix? I know the file name. If i know the inode number of the file does help more to restore back the file? (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

9. IP Networking

Able to ping server's private network

Hi guys, I'm in the progress of setting up a private network in our Sun solaris platform. Existing ip: 172.16.102.101 New private ip: 192.168.2.3 Netmask is the same for both private & public 255.255.255.0 After setting up the ip, I'm able to ping this private ip address from our... (3 Replies)
Discussion started by: *Jess*
3 Replies

Featured Tech Videos