Discuss this help topic in SecureBlackbox Forum

Initiate the connection using TElSimpleSSHClient

Before connecting, you need to configure the TElSimpleSSHClient object as required by your server. At the very least, you must set up the following properties:

  1. Server network parameters (address and port)
  2. User credentials - username and password, but in some cases you will need to also provide your private key
  3. Handle the OnKeyValidate event and implement proper key validation inside the handler
  4. (optionally) Configure cryptographic algorithms.
  5. (optionally) Configure terminal parameters.
  6. (optionally) Configure Command or Subsystem properties if you need the component to connect in command or subsystem mode instead of the default shell mode.
  7. (optionally) Handle the needed events (OnError, OnAuthenticationSuccess, OnAuthenticationFailed, OnAuthenticationKeyboard).
  8. (optionally) Set socket timeout via SocketTimeout property.


	// Set server network parameters (address and port):
	client.Address = "";
	client.Port = 22;

	// Set User credentials
	client.Username = "user";
	client.Password = "password";
	client.KeyStorage = keyStorage;

	// Handle the OnKeyValidate event
	client.OnKeyValidate += handleKeyValidate;

Now that you are ready to connect to the server, call Open() method. The method is synchronous, meaning that it would block until connection to the server is established. In case of server unavailability, the method will block for SocketTimeout milliseconds.

If any issue occurs during the negotiation, Open() method will throw an exception. This may be accompanied by OnError event if the problem occurs on the SSH layer. It makes sense to always handle OnError event to get better control over SSH negotiation and for simplifying the troubleshooting. Error handling is described in more details in the corresponding how-to article.

If Open() completes successfully, the connection has been established.

If you want to use custom sockets, see the correpsonding how-to article.

How To articles about SSH client

Discuss this help topic in SecureBlackbox Forum