SSH: Authenticate clients in SSH server
TElSimpleSSHServer offers two ways to authenticate the client.
The first method is to use build-in user database. If you use password or key-based authentication, you can use Users property to add user accounts and specify their passwords and/or keys.
TElSimpleSSHServer SSHServer = new TElSimpleSSHServer(null); // Add a user with the password SSHServer.Users.AddSSHUser("UserName", "Password", null); // Load the key's public part from somewhere ... TElSSHKey Key = new TElSSHKey(null); Key.LoadPublicKey(...); // then add a user with the key SSHServer.Users.AddSSHUser("UserWithKey", "Password", Key);
Next you set AuthenticationTypes property appropriately to allow password and/or key-based authentication.
Another, more flexible and more customizable, yet low-level, way, is the one used in TElSSHServer.
It is possible to combine both methods. In this case the result returned by the event handler will override the result of the check performed using the Users database.