using SSH in PHP invokes 'Host Key Verification Failed' error
Im trying to do a remote execution of scripts through SSH in PHP.
What im doing:
-Use PHP in conjunction with nagios' check_by_ssh script to execute the script.
How do i get it to work?
You need an entry in your known_hosts file. There's a system wide one as well as a per-user one. You can just manually run an ssh connection to that server, and then put it's hostkey in your system-wide known_hosts file. I'm not sure but you may need to clean out the PHP users too.
Also, I know PHP has some built in SSH functionality, are you sure you want to be calling a shell process for this?
im currenly tapping on the ssh script for testing purpose. If possible, it will introduce a much simpler solution for my case :) I will give it a try on the system wide known hosts file.
Thanks for your feedback.
In my experience, the best way to do SSH from PHP is with phpseclib, a pure PHP SSH client. To do what you're trying to do you'd do something like....
$ssh = new Net_SSH2();
|All times are GMT -5. The time now is 11:55 PM.|