linux - "Host key verification failed"使用 PHP 脚本 - CentOS

标签 linux ssh centos ejabberd

我正在尝试使用 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

但没有成功。

任何引用资料都会很有帮助。提前致谢。

最佳答案

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

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

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

关于linux - "Host key verification failed"使用 PHP 脚本 - CentOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33915005/

相关文章:

awk - 用于交换列的 SED 表达式

linux - Perf:找不到 "branch-load-misses"指标的有用描述

linux - 如何在多台Linux机器上同时触发某个shell脚本?

linux - Shell 脚本 mkdir(如果没有)和 mv 文件到每一天

emacs - 在Emacs中使用sudo(tramp)打开远程(SSH)文件失败

git - 我可以从一个绝对没有安装 Git 命令的简单文件服务器克隆吗?

tomcat - 我能知道如何在 centos 服务器上部署我的 spring boot 应用程序吗……提一下这个应用程序在本地主机上运行良好

c - 为什么 fstat(2) 和 fstat(3) 都存在,我应该使用哪一个?

amazon-web-services - 从引擎场中的另一个环境访问一个环境

python - 如何从 Repo 安装 jasmin SMS Gateway the systemd