Subject: Multiple authentications for SFTP connection

Multiple authentications for SFTP connection

From: Keith Martin <>
Date: Thu, 4 Feb 2016 16:48:22 +0400


I'm trying to connect to a SFTP service which requires both
username/password and public/private key authentication at the same time.

I can connect using the command line SFTP, for example:

sftp -o "IdentityFile=keyfile.txt"
Connecting to
EFT Server Enterprise passphrase for key 'keyfile.txt':
Authenticated with partial success.
Enter password:

What I can't figure out is a way within libssh2 to perform both of these
authentication steps. If I try either libssh2_userauth_publickey_frommemory
or libssh2_userauth_password both of these return an immediate failure.

Is there any way within libssh2 to get this form of double authentication?


Received on 2016-02-04