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:
- DiffieHellman.dll
- Org.Mentalis.Security.dll
- Tamir.SharpSSH.dll
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.
I look the look of your application, and I looks just like what I require.
Just wondering if you are will to save me some time and effort and share the source
one can source code of the program?
Thanks for your comments. Unfortunately, I can’t share the source code
this is good a description but i coudnt use this dll.İ am working sinde 2 days but, it connected yet. i a get an error as follows:
Tamir.SharpSsh.jsch.JSchException: System.Net.Sockets.SocketException: The reque
sted name is valid, but no data of the requested type was found
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostByName(String hostName)
at Tamir.SharpSsh.java.net.Socket..ctor(String host, Int32 port)
at Tamir.SharpSsh.jsch.Util.createSocket(String host, Int32 port, Int32 timeo
ut)
at Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
at Tamir.SharpSsh.jsch.Session.connect()
at Tamir.SharpSsh.SshBase.ConnectSession(Int32 tcpPort)
at Tamir.SharpSsh.SshBase.Connect(Int32 tcpPort)
at Test_sftp.Program.Main(String[] args) in ….
thanks, good working.
It seems that an issue with DNS. Check this out:
http://stackoverflow.com/questions/13935839/sftp-connectivity-dns-issue-system-net-sockets-socketexception-the-requested
More from stackoverflow:
http://stackoverflow.com/questions/18747628/asp-net-mvc3-the-requested-name-is-valid-but-no-data-of-the-requested-type-was
http://stackoverflow.com/questions/13935839/sftp-connectivity-dns-issue-system-net-sockets-socketexception-the-requested
hi, this is more helpful if you could share the source code
Sorry I can’t. It’s copyrighted