Authenticate an SSH connection.
boolean = ssh.auth(sshconn, username, password | { pass, prv, pub })
Parameter Description sshconn An active ssh-conn connection. username String containing the account username to connect as. password String containing the account password. pass String containing the passphrase of the private key (used with key-based authentication). prv String containing the location of the private key (used with key-based authentication). pub String containing the location of the public key (used with key-based authentication).
Returns true if successful. Any failure to authenticate returns false.
None
The following example demonstrates how to authenticate via user/pass or a keypair.
global username = "user"; global password = "pass"; global rsa_keys = { pass="rsapass", prv="~/.ssh/id_rsa", pub="~/.ssh/id_rsa.pub" }; /* you can authenticate with a user/pass pair */ if (ssh.auth(conn, username, password)!=true) { print("failed auth"); exit; } /* or you can authenticate with keys */ if (ssh.auth(conn, username, rsa_keys)!=true) { print("failed auth"); exit; }