【问题标题】:Connect to SUSE using libssh使用 libssh 连接到 SUSE
【发布时间】: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


【解决方案1】:

检查/etc/ssh/sshd_config。你应该在那里找到PermitRootLogin forced-command-only。将其设置为yes,您的问题应该会消失。请记住,人们决定不允许每个默认 root 用户/密码登录是有原因的。

【讨论】:

  • 在我测试过的所有其他服务器上,我也使用root作为用户
  • 这些配置设置从分发到分发和管理员到管理员不同
猜你喜欢
  • 2015-11-04
  • 1970-01-01
  • 2019-04-19
  • 1970-01-01
  • 1970-01-01
  • 2020-11-04
  • 2016-09-17
  • 2014-12-26
  • 1970-01-01
相关资源
最近更新 更多