【发布时间】:2018-02-23 11:23:25
【问题描述】:
我正在尝试使用 libssh(https://www.libssh.org/) 与安装了 SUSE Enterprise 操作系统的计算机建立连接。
ssh_options_set(tempSshSession, SSH_OPTIONS_HOST, host2Connect);
ssh_options_set(tempSshSession, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
ssh_options_set(tempSshSession, SSH_OPTIONS_PORT, &port);
int rc = ssh_connect(tempSshSession);
if(rc != SSH_OK) {
printf("Error connecting to the localhost\n");
exit(-1);
}
// Authorized by the password.
rc = ssh_userauth_password(tempSshSession, username, password);
ssh_userauth_password() 调用后返回响应:“SSH_AUTH_DENIED: Authentication failed: use another method”
它适用于以下操作系统:Ubuntu、Linux Generic 和 CentOS。
谢谢
【问题讨论】:
-
对这个问题投反对票是很诱人的。 stackoverflow.com/help/how-to-ask。我只对恶意意图和重大过失投反对票。我给你怀疑的好处。但紧紧抓住别人不会那么善良。
-
用户名是
root吗? -
当它在其他系统上运行时,它看起来像是一个 sshd 配置错误(或至少不同)。你能检查一下配置吗?不用程序能建立连接吗?
-
是的,它是....
-
来自 PuTTY 的@xyious 它可以工作
标签: c++ linux authentication suse libssh