Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to create a known_host entry but for some security ( permission ) reasons cannot add it directly when prompted for adding.

Are you sure you want to continue connecting (yes/no) --> cannot say Yes

Wondering if there is a way to generate the entry ( print on command line ), so I can put it manually in the known_hosts file. I have the RSA key fingerprint.

TO paraphrase the question can I specify my own known_host entry file to generate the above entry ?

Just fyi:- I also have access to ssh-keygen command, ssh-keyscan and others are not available. Please comment if above information is insufficient and I can answer

share|improve this question

migrated from stackoverflow.com Apr 24 '12 at 16:52

This question came from our site for professional and enthusiast programmers.

Have you tried fixing the permissions problem? What does 'ls-l ~/.ssh' say? –  stinkymatt Apr 23 '12 at 21:24
Why can you not say Yes? Or rather, why do you think you can't? –  ghoti Apr 23 '12 at 23:09

2 Answers 2

up vote 3 down vote accepted

You can use the -o switch to your ssh command to manually specify an alternative hosts file:

$ ssh -o UserKnownHostsFile=~/known_hosts.txt myserver

That will put the content into known_hosts.txt in your home directory, or you can change it to anywhere you should have write permissions to.

share|improve this answer

If you use this:

ssh -o StrictHostKeyChecking=no server.example.net

you may be able to avoid the question altogether.

share|improve this answer

Your Answer


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.