This is a console app that doubles as a Windows Service in C#.NET to persist an SSH connection.  It attempts reconnection automatically if a connectio

rmill12 / SshService

submited by
Style Pass
2021-07-08 19:30:07

This is a console app that doubles as a Windows Service in C#.NET to persist an SSH connection. It attempts reconnection automatically if a connection drops, and by nature of Windows Services, it starts automatically at Windows startup.

My experience has been that using tools (like PuTTY) can be hard to ensure SSH connections are persistent. Server reboots often require manual opening and starting SSH connections. This service can be very helpful in cases where you would typically use an SSH tool, but have to manually restart the SSH connection if it drops or the machine reboots.

host: The server you're connecting to. user: The username you're using to connect. pass: The password you're using to connect. port: The port number you're using to connect to the host. privateKeyFile: The path to the key file if you're using one. forwardedPort: The forwarded port number. forwardedAddress: The forwarded IP address. pollIntervalSeconds: The interval (in seconds) at which the service checks the SSH connection. toEmails: The list of email addesses that will receive notifications when the services starts or ends, or when the SSH connection opens or closes. tryToRepoenLimit: Number of times the service will attempt to reopen the SSH connection if it drops.

Leave a Comment
Related Posts