Subject: SshShell : Response reading timed out
Date: 2019-12-12 15:41:00
From: kataria0878
Source: sshshell-response-reading-timed-45242454-839f-4c42-a8e3-daad6e708966
----------------------------------------------------------------------

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

----------------------------------------------------------------------

Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index