libssh プログラムがローカルホストへの接続に失敗する理由はわかりませんが、リモート ホストでは問題なく動作します。
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");
プログラムはセッションを正常に作成できますが、認証を取得しようとすると、常に最後の行で失敗します。私が得たエラーメッセージssh_userauth_password
はです(Access denied. Authentication that can continue: publickey,keyboard-interactive)
。