1

I have no idea why my libssh program fails to connect to the localhost but it works fine for remote host.

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

The program can successfully create the session but it always failed in the last line when I tried to get authenticated. The error message I got from ssh_userauth_password is (Access denied. Authentication that can continue: publickey,keyboard-interactive).

Jes
  • 2,614
  • 4
  • 25
  • 45

1 Answers1

1

you see the config /etc/ssh/sshd_config

change passwordauthentication no to passwordauthentication yes

refer: Permission denied (publickey,keyboard-interactive)

Community
  • 1
  • 1
wunaozai
  • 59
  • 2