Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I create an entry in a ssh known_hosts file from hostname and host key?

I want to do it without trying to connect to the remote system, automaticaly loading the key over untrusted network and adding it to ~/.ssh/known_hosts by answering "yes" and hoping that there is currently no man in the middle attac. Instead I want to go to the remote system copy some files from /etc/ssh to an USB storage pen, or floppy disk, carry that media to the other system and create the known_hosts entry from the content of that media.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

hostname,ip ssh-rsa keycontentshere

ssh-rsa might be different if the key is generated using AES or another method. Of course, making a connection to the machine in question should automatically create the host key.

share|improve this answer
1  
echo gvcentostest $(cat gvcentostest/etc/ssh/ssh_host_rsa_key.pub)>>All/etc/ssh/ssh_known_hosts did it. My question was caused by my frustration about the content of /etc/ssh/ssh_host_key.pub which doesn't fit to the known_hosts files. Thank you for the answer. It made me have a closer look into /etc/ssh . I do apologize. –  Matthias Müller-Reineke Jul 1 '10 at 10:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.