Libssh2 userauth hostbased fromfile ex
From Libssh2
int libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session,
const char *username, int username_len,
const char *publickey, const char *privatekey,
const char *passphrase,
const char *hostname, int hostname_len,
const char *local_username, int local_username_len);
#define libssh2_userauth_hostbased_fromfile(session, username, publickey, privatekey, passphrase, hostname) \
libssh2_userauth_hostbased_fromfile_ex((session), \
(username), strlen(username), \
(publickey), (privatekey), (passphrase), \
(hostname), strlen(hostname), \
(username), strlen(username))
[edit]
About
Attempt host-based public key authentication using a PEM encoded private key file stored on disk. This allows the connecting application to use a single key to authenticate any of its local users to any remote account, however because of the high degree of trust necessary between hosts, the private key is typically only readable by the root user.
[edit]
Parameters
- session
- Session instance as returned by libssh2_session_init().
- username
- Remote user name to authenticate as.
- username_len
- Length of username.
- publickey
- Path and name of public key file. (e.g. /etc/ssh/hostkey.pub)
- privatekey
- Path and name of private key file. (e.g. /etc/ssh/hostkey)
- passphrase
- Passphrase to use when decoding private key file.
- hostname
- Host name client will declare itself as to the server. Not necessarily the cannonical hostname.
- hostname_len
- Length of hostname parameter.
- local_username
- Name of local user requesting authentication as remote username. Sometimes used for additional ACL by remote host.
- local_username_len
- Length of local_username.
[edit]
Returns
- On Success: 0
- On Failure: -1
