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

Posted on 2009-12-25
Last Modified: 2012-06-27
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.

Question by:tittu
    LVL 4

    Expert Comment


    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

    it should work.

    LVL 15

    Accepted Solution

    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.

    Author Closing Comment

    i will verify

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now