0

I have configured the Ruby On Rails Project on the Apache with the passenger but when I am doing the ssh using the application then its not working and gives this error in the apache log.

Could not create directory '/var/www/.ssh'.

Host key verification failed.

But when I run the same project on the WEBrick server then it works fine.

I am running the command in following way.

system("ssh machine command")

4
  • Yeah, @swati has it right. Probably issues with apache running as a different user, such as apache or root. Commented May 15, 2012 at 11:04
  • @MarlinPierce how can I check the apache is running as which user...any idea? Commented May 15, 2012 at 11:14
  • Thanks...@MarlinPierce I can see the difference in the user. when I check the user with apache it says www-data and when I so the same opetaion with the Webrick server then it says root....But how can I achieve the running the ssh command in the apache..any solution...? Commented May 15, 2012 at 13:31
  • You are going to have to play around and see what the errors are. ~swati gave you the link for adding the ssh host key, which is your current error. There could be file permission issues and environment variable issues, but each is its own question, and if you use search engines, you can find specific answers. Good luck. Commented May 15, 2012 at 14:19

2 Answers 2

2

Check it out : http://blog.servergrove.com/2010/08/02/ssh-strange-error-host-key-verification-failed/

Sign up to request clarification or add additional context in comments.

2 Comments

In my case the remote server's keys are already added to the known_host file. And more important that ssh is working with the webrick server and not with the apache
Webrick is probably running as you, Apache is running as a different user (www-data, usually), as such it'll have a different known_hosts file
0

Host Key Verification Failure happens because you've already attempted to connect to a host @ the same address, but the key that identifies the SSH server does not match the one that you connected to previously.

Make sure you are connecting to the server you think you are

If you are absolutely certain you are connecting to the same server then you can do one of the following:

  • Remove the offending key from ~/.ssh/known_hosts and try again
  • Edit your ssh config ( /etc/ssh/ssh_config ) and disable host-key checking: StrictHostKeyChecking no

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.