“主机密钥验证失败”使用PHP脚本 - CentOS [英] "Host key verification failed" using PHP Script - CentOS

查看:260
本文介绍了“主机密钥验证失败”使用PHP脚本 - CentOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 PHP 脚本创建 eJabberd 用户。



我的本地系统(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' $ status);

if($ output == 0)
{
echo用户创建成功。
}
else
{
//失败,$ output有详细信息
echo'< pre>';
foreach($ output as $ o)
{
echo $ o。\\\
;
}
echo'< / pre>';
}

但是当我试图在服务器
它给我以下错误:

 主机密钥验证失败。 

我尝试了一些解决方案:



http://askubuntu.com/questions/45679/ssh-连接问题与主机密钥验证失败错误



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



但未成功。 / p>

任何参考都会非常有帮助。提前感谢。

解决方案

找到一个更好的方式让用户到 eJabberd 服务器。



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



提供您对服务器进行REST调用。


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 :

http://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.

解决方案

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.

这篇关于“主机密钥验证失败”使用PHP脚本 - CentOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆