I'm trying to run the command ssh -o StrictHostKeyChecking=no but I'm a bit lost as to how to run it. I've tried running it from a shell script, but the output was the man page or settings that lists out all the parameters.

I then tried running that command from the shell (Cygwin) itself, but got the same man output. How do I run the command? Do I need to provide credentials or anything?

  • From which OS, other than Cygwin/Windows, did you try it? – Incnis Mrsi Sep 11 '15 at 18:37
  • I tried it on an AWS EC2 instance and got the same result. I don't have command line access to it though; the instance is spun up via datapipeline – simplycoding Sep 11 '15 at 18:39
  • Did you specify the target hostname? It’s a mandatory argument of the command. How does the full command line look? – Incnis Mrsi Sep 11 '15 at 18:43
  • what are you trying to do? – Jakuje Sep 11 '15 at 18:53
  • The full command line looks just like that command from the initial post. @Jakuje what I'm trying to do is edit the settings so that an sftp connection automatically accepts keys. On first login from a new computer, I get prompted to accept the key, but need this automated – simplycoding Sep 11 '15 at 19:46

Taken from my answer on Ask Different:

You can simply try it as it is without confitguration, just on commandline:

sftp -o StrictHostKeyChecking=no hostname

but I don't think it does all what you need. If you want to ignore all hostkey checking, you need to set up you known_hosts file to /dev/null so there will be never anything stored:

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

or in /etc/ssh_config:

Host hostname
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

for specific hostname or you can use * for all host names

  • 1
    You may need to edit and remove a few backticks ` – Ned64 Sep 11 '15 at 20:13
  • @Ned64 thanks. It looks like I missed some – Jakuje Sep 11 '15 at 20:14
  • I'm still getting the man results when I try this: sftp -o StrictHostKeyChecking=no sftp.host.me -i key.pem username@sftp.host.me – simplycoding Sep 11 '15 at 21:17
  • read on ;) There is more written in the answer. – Jakuje Sep 11 '15 at 21:26
  • Same thing. I figured it would be easier to point out that the first suggestion wasn't working – simplycoding Sep 11 '15 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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