Site icon port135.com

Remote server connection by SSH using C#

SSH is a secure network protocol to use remote shell services or execute commands. You can connect to a remote server by SSH on Visual Studio. To do this, you need a SSH library. My suggestion is SharpSSH.

Download DLL files from SourceForge. You should add these DLL files to your Visual Studio project:

To connect to server and execute commands, code is here:

SshExec shell = new SshExec(hostIP, username);
shell.Password = password;
shell.Connect();
string output = shell.RunCommand(command);
shell.Close();

My SSH application is below. It is a simple SSH Command Prompt.

SSH Command Prompt
Exit mobile version