[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Double authentication using libssh


Hi All,

My SSH server uses double authtication. I do not know how its implemented.
But initially its asks for a password, then again asks for another password
to login to a separate console which is different from usual control.

My code is similar to the example code shown in the documentations,

#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <libssh/libssh.h>


int main(int argc, char * argv[])
{
ssh_session my_ssh_session = ssh_new();
int rc;
char * password;
char * username = "admin";
// Check if ssh session exists.
if(my_ssh_session == NULL)
{
exit(-1);
}

ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "x.x.x.x");

rc = ssh_connect(my_ssh_session);
if (rc != SSH_OK)
{
fprintf(stderr, "Error Connecting to Server: %s.\n",
ssh_get_error(my_ssh_session));
exit(-1);
}

password = getpass("Password: ");
rc = ssh_userauth_password(my_ssh_session, username, password);
if (rc != SSH_AUTH_SUCCESS)
{
fprintf(stderr, "ERROR Authenticating: %s.\n",
ssh_get_error(my_ssh_session));
ssh_disconnect(my_ssh_session);
ssh_free(my_ssh_session);
}
else
{
printf("Authentication Successful.\n");
}

ssh_free(my_ssh_session);
}

How do i implement a double authtication in this ? can you kindly help me
out ?

Thanks,
Bala.

Follow-Ups:
Re: Double authentication using libsshTilo Eckert <tilo.eckert@xxxxxxx>
Archive administrator: postmaster@lists.cynapses.org