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.

I would like to access my new virtual server in the cloud with ssh from an install script so that it does not ask for user interaction. When I use plain

ssh -i keys.pem user@host.com

it does tell me that this is a new host, do I trust it? As I freshly create this, I want to trust it without further ado.

Then I did use

-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no

but this does not establish the connection so that later requests go automatically. It does not create the entry in known_hosts.

How can I make ssh to connect non-interactively first and then all the time?

  • Gergely
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Have you tried just using the following?

$ ssh -o StrictHostKeyChecking=no -i keys.pem user@host.com

I don't see the point of having -o UserKnownHostsFile=/dev/null as well; this just seems to prevent the addition of the key to your known hosts file.

share|improve this answer
2  
Also, BatchMode=yes would be a good addition. –  Janne Pikkarainen Jun 9 '11 at 9:54

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.