Connect to SUSE using libssh

117 views Asked by At

I am trying to establish a connection using libssh(https://www.libssh.org/) to a machine with SUSE Enterprise operating system installed.

    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);

After ssh_userauth_password() call it returns the response : "SSH_AUTH_DENIED: Authentication failed: use another method"

It works fine for operating systems like: Ubuntu, Linux Generic and CentOS.

Thanks

1

There are 1 answers

2
Kaveh Vahedipour On

Check /etc/ssh/sshd_config. You should find PermitRootLogin forced-command-only somewhere there. Set that to yes and your problem should be gone. Please keep in mind that there is a reason, why folks have decided to not allow per default root user/pass logins.