-
-
Notifications
You must be signed in to change notification settings - Fork 4
SSH.Agent
Andrew Lambert edited this page Nov 26, 2022
·
14 revisions
SSH.Agent
Protected Class Agent
This class communicates with a key management service running on the local system (the "agent"). The agent manages the user's SSH keys and authenticates to remote SSH servers on behalf of SSH-aware apps running as the same local user. Access to a user's keys is granted when the user successfully signs in to the local machine. This relieves the user of having to type in their credentials every time a SSH session is begun, and relieves the SSH-aware app of responsibility for securing user keys.
This example demonstrates how to use the Agent
class to log on to a remote server.
Dim session As New SSH.Session
If Not session.Connect("ssh.example.com", 22) Then MsgBox("Can't connect!")
Dim agent As New SSH.Agent(session)
If Not agent.Connect() Then MsgBox("Can't contact agent!")
If Not agent.Refresh() Then MsgBox("Can't get the key list!")
Dim c As Integer = agent.Count - 1
For i As Integer = 0 To c
If session.SendCredentials("myusername", agent, i) Then
MsgBox("Logged in successfully!")
Exit For
End If
Next
agent.Disconnect()
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.