Issue #2243: suppress prompt to save a yet unknown host key in ssh.exe mode, by disabling StrictHostKeyChecking and UserKnownHostsFile . I have no clue to where ssh.exe sends that message, it's neither in stdOut nor in stdErr.

This commit is contained in:
Ansgar Becker
2025-08-25 17:42:15 +02:00
parent 95b1b02bff
commit 5f37814cb0

View File

@@ -1158,6 +1158,8 @@ begin
SshCmd := SshCmd + IfThen(IsPlink, ' -P ', ' -p ') + IntToStr(FConnection.Parameters.SSHPort);
if FConnection.Parameters.SSHPrivateKey <> '' then
SshCmd := SshCmd + ' -i "' + FConnection.Parameters.SSHPrivateKey + '"';
if not IsPlink then
SshCmd := SshCmd + ' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null';
SshCmd := SshCmd + ' -N -L ' + IntToStr(FConnection.Parameters.SSHLocalPort) + ':' + FConnection.Parameters.Hostname + ':' + IntToStr(FConnection.Parameters.Port);
rx := TRegExpr.Create;
rx.Expression := '(-pw\s+")[^"]*(")';