• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4140
  • Last Modified:

C# SSH client example to execute remote commands on Linux BOX.

the requirement is  like
BOXA -> Fedora 8 Linux Box running with OpenSSH Server and my main application

BOXB->  C# .Net Program should able to connect to Linux OpenSSH in non interactive modewithout prompting for username and password and should able to execute remote commandslike removing files / creating dirs etc on BOX A.

I need an example program in C# .Net to deploy in BOXB which should able to do the above.

1 Solution

Implementing your own SSH client is a quite hard task, but you should be able to execute a batch file your code created using an SSH client like Putty.

If you create a simple batch file(StreamWriter is what you will need), and the execute something like this, from C#:
putty -ssh -l username -P port -pw password -m yourbatch.file your.host

it should work.

Have a look at this library:

I've used it for creating tunnels to secure MySQL connections in one of my apps and it worked a treat.
tittuAuthor Commented:
i will verify
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now