[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ssh_user_auth_none Permission denied
[Thread Prev] | [Thread Next]
- Subject: ssh_user_auth_none Permission denied
- From: "Sruthi Mohan (RBEI/EIA1)" <Sruthi.Mohan@xxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Fri, 18 Mar 2016 11:27:43 +0000
- To: "libssh@xxxxxxxxxx" <libssh@xxxxxxxxxx>
Dear All, I am trying to connect to the server using ssh. I get Access denied for ssh_user_auth_none. Authentication that can continue Public key As per ssh_userauth_list list PUBLIC KEY authentication is valid Post that ssh_userauth_try_publickey and ssh_pki_import_pubkey_file also fails. Kindly let me know the possible reason failure Attached code below int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); ssh_session my_ssh_session; int verbosity = SSH_LOG_PROTOCOL; int port = 155; my_ssh_session = ssh_new(); if (my_ssh_session == NULL) { exit(-1); } ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, myip); ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port); int rc = ssh_connect(my_ssh_session); if (rc != SSH_OK) { qDebug()<<"Error connecting to host:"<<ssh_get_error(my_ssh_session); exit(-1); } rc=verify_knownhost(my_ssh_session); rc = ssh_userauth_none(my_ssh_session, NULL); if (rc != SSH_AUTH_SUCCESS) { qDebug()<<"Error connecting to localhost: %s\n"<<ssh_get_error(my_ssh_session); // return rc; } int method = ssh_userauth_list(my_ssh_session, NULL); if (method & SSH_AUTH_METHOD_NONE) { qDebug()<<"Authenticate None"; } if (method & SSH_AUTH_METHOD_PUBLICKEY) { qDebug()<<"Authenticate pubkey"; } if (method & SSH_AUTH_METHOD_INTERACTIVE) { qDebug()<<"Authenticate keyboard"; } if (method & SSH_AUTH_METHOD_PASSWORD) { qDebug()<<"Authenticate password"; } if (ssh_pki_import_pubkey_file(PublickeyFile.toStdString().c_str(), &pubkey) != SSH_OK) { qDebug()<<"Failed to import the key"; } if(ssh_userauth_try_publickey(my_ssh_session,"S3DDM",pubkey)==SSH_ERROR) { qDebug()<<"Failed to import the key"; } ssh_free(my_ssh_session); ssh_disconnect(my_ssh_session); return a.exec(); } Best regards Sruthi Mohan RBEI/EIA1 Tel. +91(80)6783-7826
Re: ssh_user_auth_none Permission denied | David Kedves <kedazo@xxxxxxxxx> |
Re: ssh_user_auth_none Permission denied | Tilo Eckert <tilo.eckert@xxxxxxx> |