SshShell : Response reading timed out

0
Hi Team, I want to build a web application(MVC) with feature to execute (PuTTY) commands online. I implemented the sample code as below public string ComponentProMethod(SSHModel model) { // Create an SshClient object. SshClient client = new SshClient(); string response = ""; try { // Sftp sftp = new Sftp(); client.Config.KeyExchangeAlgorithms = ComponentPro.Net.SecureShellKeyExchangeAlgorithm.DiffieHellmanGroup1SHA1; // Connect to the specified server. client.Connect(model.host); // Authenticate. client.Authenticate(model.username, model.password); client.Timeout = 25000 * 2; // Create a shell object in auto-processing mode. TerminalShell shell = client.CreateShell(true); // Send the command to the SSH server and read response. response = shell.ExecuteCommand(model.command); // Close the connection. client.Disconnect(); } catch (Exception se) { response = "An SSH exception occurred: " se.Message; } finally { // Close the connection. client.Disconnect(); } return response; } When SshClient creating the remote shell (TerminalShell shell = client.CreateShell(true)), then system throw error 'Response reading timed out'. I also tried with manual processing on creating shell, but failed to get command response. I also checked https://www.componentpro.com/qa/sshshell-response-reading-timed Please look into the matter Thanks in Advance
 
asked 12/12/2019 3:41:00 PM
  Updated : When i tried to false auto processing with set prompt with "TestASA.*[>#]" and command is "?" ,then it responses help keywords.Now when i execute CISCO SSH command i.e. "enable" then it is throwing error reading time out. kataria0878 12/13/2019 4:56:52 AM
add a comment

1 Answers

0
It looks like the client cant find the matching prompt. You may want to use `SshTerminalControl` instead to send/receive commands.
 
answered 12/21/2019 6:33:13 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged asp.net mvc or ask your own question.