“Host key verification failed” using PHP Script - CentOS

依然范特西╮ 提交于 2019-12-11 10:27:07

问题


I am trying to create eJabberd users using PHP script.

The following script is working perfectly on my local system(Ubuntu 14.04) :

<?php
error_reporting(E_ALL);
ini_set('display_errors', '-1');

$username   = 'userx1';
$password   = '123456';
$node       = 'localhost';

exec('ssh -t -t <hostname> ejabberdctl register '.$username.' '.$node.' '.$password.' 2>&1', $output, $status);

if($output == 0)
{
    echo "User created successfully.";
}
else
{
    // Failure, $output has the details
    echo '<pre>';
    foreach($output as $o)
    {
        echo $o."\n";
    }
    echo '</pre>';
}

But when I am trying to run on the server(CentOS). Its giving me following error :

Host key verification failed.

I tried some solutions like :

https://askubuntu.com/questions/45679/ssh-connection-problem-with-host-key-verification-failed-error

https://www.youtube.com/watch?v=IJj0uD7EgGk

but no success.

Any reference will be very helpful. Thanks in advance.


回答1:


Found A better way to crate user to eJabberd server.

mod_rest : https://github.com/processone/ejabberd-contrib/tree/master/mod_rest

Provides you to make REST calls to the server.



来源:https://stackoverflow.com/questions/33915005/host-key-verification-failed-using-php-script-centos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!