Set the active SSH UserID and optional password to setup automatic connection without prompting to the terminal session following the initial call to the connect method.
bool HostConnection.setSSHUser(String sshUserID) bool HostConnection.setSSHUser(String sshUserID, String sshPassword) |
Arguments
HostConnection
Required. HostConnection object.
sshUserID
Required. | This will be used to connect the SSH session. Depending on the active host configuration for the SSH host, this may be all that is needed (what might be referred to as "low security") or more commonly, the userID will be combined with an SSH Key and/or Password. |
passPassword
Optional. | If the SSH Host configuration includes the use of a password (possibly in addition to an SSHKey or instead of an SSHKey), pass this parameter with the user's password if you wish the logon to be fully automatic. If this is required for the connection but is not set using this method prior to the connect method, the user will be prompted for the password as the first prompt seen following a successful connection. |
Remarks
setSSHUser must be called after a new HostConnection object is created and before the connect method is called.
Returns false if the HostConnection is invalid, true if the HostConnection is valid and has not been connected yet.
To work properly, the HostConnection object hostName must match an existing SSH Server with a configuration setup for credential use matching the server being connected to.
The following sample sets the user ID and password using strings read from a DB or other configuration data source:
bool SetSSHUser(HostConnection oConn, string userID, string passWord)
{
return oConn.setSSHUser(userID, passWord);
}
© 2022 Inventu Corporation