Implement 'atKeyboardInteractive'
Posted: Mon 07 Sep 2020 06:22
Dear Support,
I want to apply ScSSHAuthetications := atKeyboardInteractive , but always got error message :
'Authentication failed publickey, password, keyboard-interactive',
Is there any setting that I miss ?
Here is the code for connection :
procedure TForm1.btnConnectClick(Sender: TObject);
const
ErrMsg = 'The following error is arised on %s: '#13#10 +
'%s' + #13#10 + 'Disconnect SSH connection?';
var
OldCursor : TCursor;
sMsg : string;
begin
if ScSSHClient.Connected then
begin
try
ScSSHShell.Disconnect
finally
ScSSHClient.Disconnect;
end;
end
else
begin
OldCursor := Screen.Cursor;
try
// Init parameter
ScSSHClient.HostName := edServerIP.Text;
ScSSHClient.Port := StrToInt(edSrvPort.Text);
ScSSHClient.User := edUsername.Text;
// ScSSHClient.Password := edPass.Text;
ScSSHClient.Authentication := atKeyboardInteractive;
// ScSSHClient.Authentication := atPassword;
Screen.Cursor := crHourGlass;
try
ScSSHClient.Connect;
except
on E: Exception do
begin
sMsg := 'Error on SSH connection to :'+ScSSHClient.HostName+
':'+ IntToStr(ScSSHClient.Port)+' - '+ E.Message;
Logging(sMsg);
end;
end;
try
ScSSHShell.Connect;
Logging('Command Shell Opened.');
except
on E: Exception do
begin
sMsg := 'Error on opening command shell :'+ E.Message;
Logging(sMsg);
if MessageDlg(Format(ErrMsg,['Opening command shell',E.Message]),
mtError,[mbYes,mbNo],0) = mrYes then
begin
try
ScSSHShell.Disconnect
finally
ScSSHClient.Disconnect;
end;
end;
end;
end;
finally
Screen.Cursor := OldCursor;
end;
end;
end;
Regards,
Eri
I want to apply ScSSHAuthetications := atKeyboardInteractive , but always got error message :
'Authentication failed publickey, password, keyboard-interactive',
Is there any setting that I miss ?
Here is the code for connection :
procedure TForm1.btnConnectClick(Sender: TObject);
const
ErrMsg = 'The following error is arised on %s: '#13#10 +
'%s' + #13#10 + 'Disconnect SSH connection?';
var
OldCursor : TCursor;
sMsg : string;
begin
if ScSSHClient.Connected then
begin
try
ScSSHShell.Disconnect
finally
ScSSHClient.Disconnect;
end;
end
else
begin
OldCursor := Screen.Cursor;
try
// Init parameter
ScSSHClient.HostName := edServerIP.Text;
ScSSHClient.Port := StrToInt(edSrvPort.Text);
ScSSHClient.User := edUsername.Text;
// ScSSHClient.Password := edPass.Text;
ScSSHClient.Authentication := atKeyboardInteractive;
// ScSSHClient.Authentication := atPassword;
Screen.Cursor := crHourGlass;
try
ScSSHClient.Connect;
except
on E: Exception do
begin
sMsg := 'Error on SSH connection to :'+ScSSHClient.HostName+
':'+ IntToStr(ScSSHClient.Port)+' - '+ E.Message;
Logging(sMsg);
end;
end;
try
ScSSHShell.Connect;
Logging('Command Shell Opened.');
except
on E: Exception do
begin
sMsg := 'Error on opening command shell :'+ E.Message;
Logging(sMsg);
if MessageDlg(Format(ErrMsg,['Opening command shell',E.Message]),
mtError,[mbYes,mbNo],0) = mrYes then
begin
try
ScSSHShell.Disconnect
finally
ScSSHClient.Disconnect;
end;
end;
end;
end;
finally
Screen.Cursor := OldCursor;
end;
end;
end;
Regards,
Eri