使用libssh连接到SUSE

Connect to SUSE using libssh

本文关键字:SUSE 连接 libssh 使用      更新时间:2023-10-16

我正在尝试使用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 localhostn");
        exit(-1);
    }
    // Authorized by the password.
    rc = ssh_userauth_password(tempSshSession, username, password);

ssh_userauth_password()调用后将其返回响应:" ssh_auth_denied:身份验证失败:使用另一种方法"

它适用于以下操作系统,例如:Ubuntu,Linux Generic和Centos。

谢谢

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