Delphi ActiveX
Delphi ActiveX
Authenticate an SSH Tunnel with a Password
See more Socket/SSL/TLS Examples
Demonstrates Socket.SshAuthenticatePw, which authenticates an SSH tunnel session using a login and password. Call SshOpenTunnel first.
Background. Authenticate before opening forwarded channels. The password should come from a secure source and never be logged; public-key authentication is often preferred.
Chilkat Delphi ActiveX Downloads
var
success: Integer;
socket: TChilkatSocket;
sshPassword: WideString;
begin
success := 0;
socket := TChilkatSocket.Create(Self);
success := socket.SshOpenTunnel('ssh.example.com',22);
if (success = 0) then
begin
Memo1.Lines.Add(socket.LastErrorText);
Exit;
end;
// Authenticate the SSH tunnel session with a login and password.
// The SSH password should come from a secure source rather than being hard-coded.
sshPassword := 'mySshPassword';
success := socket.SshAuthenticatePw('sshUser',sshPassword);
if (success = 0) then
begin
Memo1.Lines.Add(socket.LastErrorText);
Exit;
end;
Memo1.Lines.Add('SSH authentication succeeded.');