Hi, this should work for both AIX and Linux:
jmueller
_OutErr = "";
var KeyboardInteractive = new KeyboardInteractiveAuthenticationMethod(_User);
KeyboardInteractive.AuthenticationPrompt += delegate(Object senderObject, AuthenticationPromptEventArgs eventArgs)
{
foreach (var prompt in eventArgs.Prompts)
{
if (prompt.Request.Equals("Password: ", StringComparison.InvariantCultureIgnoreCase))
{
prompt.Response = "password";
}
}
};
var passwordAuthMethod = new PasswordAuthenticationMethod(_User, _Pw));
var connectionInfo = new ConnectionInfo(_Server, _User, passwordAuthMethod, KeyboardInteractive);
SshClient sshe = new SshClient(connectionInfo);
try
{
sshe.Connect();
_Out = sshe.RunCommand(_Cmd);
}
catch (Exception eConnect)
{
_OutErr = eConnect.Message;
}
finally
{
sshe.Disconnect();
sshe.Dispose();
}
regards jmueller