【问题标题】:libssh - failed to connect to localhostlibssh - 无法连接到本地主机
【发布时间】:2015-11-04 10:53:43
【问题描述】:

我不知道为什么我的 libssh 程序无法连接到本地主机,但它在远程主机上运行良好。

ssh_session my_ssh_session = ssh_new();
ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "my_user_name");
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "localhost");

int rc = ssh_connect(my_ssh_session);
if(rc != SSH_OK) {
  printf("Error connecting to the localhost\n");
  exit(-1);
}
// Authorized by the password.
rc = ssh_userauth_password(my_ssh_session, "my_user_name", "my_password");

该程序可以成功创建会话,但是当我尝试进行身份验证时,它总是在最后一行失败。我从ssh_userauth_password 收到的错误消息是(Access denied. Authentication that can continue: publickey,keyboard-interactive)

【问题讨论】:

    标签: c ssh libssh


    【解决方案1】:

    你看到了配置/etc/ssh/sshd_config

    改变 passwordauthentication nopasswordauthentication yes

    参考:Permission denied (publickey,keyboard-interactive)

    【讨论】:

      猜你喜欢
      • 2014-11-06
      • 2016-01-01
      • 2021-06-20
      • 2015-07-26
      • 2016-04-25
      • 2015-12-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多