-
-
Notifications
You must be signed in to change notification settings - Fork 4
SSH.Connect
SSH.Connect
Protected Function Connect(URL As String, KnownHostList As FolderItem = Nil, AddHost As Boolean = False) As SSH.Session
Protected Function Connect(Address As String, Port As Integer, Username As String, PublicKeyFile As FolderItem, PrivateKeyFile As FolderItem, PrivateKeyFilePassword As String, KnownHostList As FolderItem = Nil, AddHost As Boolean = False) As SSH.Session
Protected Function Connect(Address As String, Port As Integer, Username As String, PublicKey As MemoryBlock, PrivateKey As MemoryBlock, PrivateKeyPassword As String, KnownHostList As FolderItem = Nil, AddHost As Boolean = False) As SSH.Session
Protected Function Connect(Address As String, Port As Integer, Username As String, Password As String, KnownHostList As FolderItem = Nil, AddHost As Boolean = False) As SSH.Session
Protected Function Connect(Address As String, Port As Integer, Username As String, KnownHostList As FolderItem = Nil, AddHost As Boolean = False) As SSH.Session
Connect using the username, password, address, and port specified as a URL. e.g. ssh://user:[email protected]:2222
.
Name | Type | Comment |
---|---|---|
URL |
String | The fully-qualified URL of the server (including username/password). |
KnownHostList |
FolderItem | Optional. A list of known hosts to check the server against. |
AddHost |
Boolean | Optional. If True, then the server's fingerprint is added to the list if necessary. |
Connect using keys from a file.
Name | Type | Comment |
---|---|---|
Address |
String | The hostname or IP address to connect to. |
Port |
Integer | The remote port to connect to. |
Username |
String | The user to log in as. |
PublicKeyFile |
FolderItem | The user's public key. |
PrivateKeyFile |
FolderItem | The user's private key. |
PrivateKeyFilePassword |
String | The password needed to unlock the private key. |
KnownHostList |
FolderItem | Optional. A list of known hosts to check the server against. |
AddHost |
Boolean | Optional. If True, then the server's fingerprint is added to the list if necessary. |
Connect using keys from memory.
Name | Type | Comment |
---|---|---|
Address |
String | The hostname or IP address to connect to. |
Port |
Integer | The remote port to connect to. |
Username |
String | The user to log in as. |
PublicKey |
MemoryBlock | The user's public key. |
PrivateKey |
MemoryBlock | The user's private key. |
PrivateKeyPassword |
String | The password needed to unlock the private key. |
KnownHostList |
FolderItem | Optional. A list of known hosts to check the server against. |
AddHost |
Boolean | Optional. If True, then the server's fingerprint is added to the list if necessary. |
Connect with a username and password.
Name | Type | Comment |
---|---|---|
Address |
String | The hostname or IP address to connect to. |
Port |
Integer | The remote port to connect to. |
Username |
String | The user to log in as. |
Password |
String | The user's password. |
KnownHostList |
FolderItem | Optional. A list of known hosts to check the server against. |
AddHost |
Boolean | Optional. If True, then the server's fingerprint is added to the list if necessary. |
Connect using the local SSH agent.
Name | Type | Comment |
---|---|---|
Address |
String | The hostname or IP address to connect to. |
Port |
Integer | The remote port to connect to. |
Username |
String | The user to log in as (keys to be provided by an SSH agent). |
KnownHostList |
FolderItem | Optional. A list of known hosts to check the server against. |
AddHost |
Boolean | Optional. If True, then the server's fingerprint is added to the list if necessary. |
An instance of the SSH.Session class.
This convenience method establishes an SSH session to the server specified by the parameters.
If the KnownHostsList
file is specified then the server's fingerprint is checked against the list. If AddHost
is true then the fingerprint will be added to the list if it's not already present. If the server's fingerprint was found in the list but does not match the one presented by the remote host then the connection will fail even if AddHost
is True: if, and only if, this change was expected then remove the old fingerprint and try again.
Returns an instance of the Session
class even if an error occurred. Check Session.IsConnected and Session.IsAuthenticated to determine whether an error occurred, and Session.LastError for error details.
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2018-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.