Systems that run SSH usually support some kind of SFTP, so you could just use something like SSH.NET:
using (var sftpClient = new SftpClient("localhost", "root", "bugmenot")
{
sftpClient.Connect();
var files = sftpClient.ListDirectory("/tmp");
}
or SharpSSH:
Sftp sftp = new Sftp("localhost", "root", "bugmenot");
try
{
sftp.Connect();
ArrayList files = sftp.GetFileList("/tmp");
}
finally
{
sftp.Close();
}
Edit: You can run any command over SSH with both libraries. Admittedly, I have not done that, yet, but it is supposed to work like this:
SSH.NET
using (var sshClient = new SshClient("localhost", "root", "bugmenot")
{
sshClient.Connect();
var cmd = sshClient.RunCommand("ls");
var output = cmd.Result;
}
SharpSSH
SshStream ssh = new SshStream("localhost", "root", "bugmenot");
try
{
ssh.Write("ls");
var output = ssh.ReadResponse();
}
finally
{
ssh.Close();
}