• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3943
  • 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.




0
tittu
Asked:
tittu
1 Solution
 
gsx1022Commented:
HI,

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.

gsx1022
0
 
oobaylyCommented:
Have a look at this library:
http://www.codeproject.com/KB/IP/sharpssh.aspx

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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