Page 1 of 1

Implement 'atKeyboardInteractive'

Posted: Mon 07 Sep 2020 06:22
by eridatacom
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

Re: Implement 'atKeyboardInteractive'

Posted: Wed 09 Sep 2020 13:54
by ViktorV
To solve the issue try to set the TScSSHClient.Authentication property to atKeyboardInteractive and process the TScSSHClient.AuthenticationPrompt event ... ationPromp
In the event handler, you can use Prompts - the amount of requested information can be learned by defining the length of the Prompts array. Also, you should write the corresponding information to the Responses variable which will be sent to the server.

Re: Implement 'atKeyboardInteractive'

Posted: Fri 11 Sep 2020 02:46
by eridatacom
I alredy add code on TScSSHClient.AuthenticationPrompt event,

procedure TForm1.ScSSHClientAuthenticationPrompt(Sender: TObject;
const Name, Instruction: String; const Prompts: TStringDynArray;
var Responses: TStringDynArray);
begin
if (Name = '') and (Length(Prompts) = 0) then Exit;

Logging('AuthPrompt :');
Logging('Name = '+ Name);
Logging('Instr = '+ Instruction);
Responses[0] := edPass.Text;
end;

But still got the exception with error message :
'Authentication failed publickey, password, keyboard-interactive'

before the event ' TScSSHClient.AuthenticationPrompt ' is triggered.

Is there anything else I should set ?

Re: Implement 'atKeyboardInteractive'

Posted: Mon 14 Sep 2020 14:27
by ViktorV
Please make sure that your SSH server is using the keyboard-interactive authentication method -- it is likely that the password authentication is being used on your SSH server at the moment.

Also please try to connect to your SSH server using the keyboard-interactive authentication method with PUTTY. If you manage to connect to the server, please provide us with test access to your server. You can send us the connection credentials using the form on our website: https://www.devart.com/company/contactform.html

Re: Implement 'atKeyboardInteractive'

Posted: Tue 22 Sep 2020 07:32
by eridatacom
Yes you are correct, my windows 10 openSSH server Authentication cannot be set as KeyboardInteractive,
so my test module works when I try to connect to CentOS7 ssh server with KeyboardInteractive set.
Thank you for your support.

Re: Implement 'atKeyboardInteractive'

Posted: Fri 25 Sep 2020 10:38
by ViktorV
Thank you for the interest to our product.
It is good to see that the problem has been solved.
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.