我試圖連接到一個AIX盒和使用SSH.NET
庫執行某些命令。 以下是代碼snipplet無法連接到與SSH.NET圖書館AIX(UNIX)箱 - 錯誤:值不能爲空
KeyboardInteractiveAuthenticationMethod kauth = new KeyboardInteractiveAuthenticationMethod(username);
PasswordAuthenticationMethod pauth = new PasswordAuthenticationMethod(username, password);
ConnectionInfo connectionInfo = new(ConnectionInfo(servername, 22, username, pauth,kauth);
SshClient sshClient = new SshClient(connectionInfo);
sshClient.Connect();
SshCommand sshCommand = sshClient.RunCommand("mpstat");
Console.WriteLine(sshCommand.Result);
Console.ReadKey();
我得到以下異常消息當我嘗試在線路連接sshClient.Connect()
{「值不能爲空\ r \ n參數名:數據「}
堆棧跟蹤是
at Renci.SshNet.KeyboardInteractiveAuthenticationMethod.Authenticate(Session session)
at Renci.SshNet.ConnectionInfo.Authenticate(Session session)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()
我相信,我傳遞的憑據是有效的,因爲我能夠使用PuTTY
客戶端使用相同的憑據登錄。有任何想法嗎?