0

Hi, I am trying to build an application using C#.

The application will connect to a remote machine using ssh or similar way.

For example, It will connect to the remote machine and get the list of running process from that process to a text file in my local machine.

Is there any easy way I can do it. I looked into sharshh and it looks old and almost no documentation.

0

1 Answer 1

2

You may want to try the SSH.Net library on Codeplex.

Using it is quite straight forward, but you may want to adjust the command that displays running process as needed to fit your scenario:

using (var client = new SshClient("host", "username", "password"))
{
  client.Connect();
  var cmd = client.RunCommand("ps -ef");
  File.WriteAllText("your-process-file.txt", cmd.Result);
  client.Disconnect();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.