【问题标题】:"Host key verification failed" using PHP Script - CentOS“主机密钥验证失败”使用 PHP 脚本 - CentOS
【发布时间】:2016-02-28 03:42:13
【问题描述】:

我正在尝试使用 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', $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>';
}

但是当我试图在服务器(CentOS)上运行时。 它给了我以下错误:

Host key verification failed.

我尝试了一些解决方案,例如:

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

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

但没有成功。

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

【问题讨论】:

  • askubuntu.com 的答案对我来说看起来很全面。也许您可以更详细地解释您是如何尝试遵循这些建议的,以及发生了什么。
  • @Kenster 我按照 AskUbuntu 上的答案执行命令。但是当运行 PHP 脚本时,输出是相同的。我也跟着这个视频教程:https://www.youtube.com/watch?v=IJj0uD7EgGk,但没有成功。我无法追踪问题。
  • 如果您尝试手动运行 ssh 命令会发生什么情况,会出现同样的错误吗?
  • 不,我只有在通过 PHP 脚本运行时才会出错。

标签: linux ssh centos ejabberd


【解决方案1】:

找到了将用户创建到eJabberd 服务器的更好方法。

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

让您可以对服务器进行 REST 调用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-02
    • 2021-12-25
    • 2013-02-16
    • 1970-01-01
    • 2020-07-15
    • 2013-02-04
    • 1970-01-01
    • 2018-10-04
    相关资源
    最近更新 更多