KiTTY auto-reconnect ssh tunnel so you can RDP from remote machine into local one
Posted by jpluimers on 2020/04/27
I needed this equivalent in KiTTY while also keeping the connection alive:
ssh -o "ExitOnForwardFailure yes" -R :3389:127.0.0.1:3389
Here, (via [WayBack] SSH options, Port Forwarding over SSH, Keepalives – zwilnik), -R
Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side. This works by allocating a socket to listen to port on the remote side, and whenever a connection is made to this port, the connection is forwarded over the secure channel, and a connection is made to host port hostport from the local machine.
This is unlike most port forwarding examples which shows you how to forward a local port to a remote one (for instance [WayBack] Portforwarding with SSH (Putty)).
I wanted this on Windows, but auto connect, and not depend on OpenSSH. So I used the portable edition of [WayBack] Download KiTTY., which is a PuTTY derivative with more features.
With OpenSSH it is easier, but requires either Windows 10 (having it pre-installed) or an OpenSSH installation. How simple? This simple: [WayBack] openssh – How do I keep SSH connection alive on Windows 10? – Stack Overflow
The portable version of KiTTYensures all configuration is in configuration files (not the registry like the regular edition: [WayBack] KiTTY Session Configuration Location – Chase’s Notes)
I bumped into KiTTY because in another situation, I needed to execute a remote command and found [WayBack] ssh – How to run a remote command in PuTTY after login & keep the shell running? – Super User
Later I found other references as it can also auto-logon:
- [WayBack] PuTTY enhanced: Auto-Login + Auto-Reconnect on internet failure
- [WayBack] PuTTY – Automatic Reconnect After Internet Interruption? – Super User
Kitty has a URL based update checker; for instance [WayBack] www.9bis.net/kitty/check_update.php?version=0.70.0.6 checks if a newer version than 0.70.0.6 is available. If you do not trust it, you can run that URL over TLS as well.
These screenshots seem to do just get the above configuration:
- Under “SSH”, in “Tunnels”
- tick “Remote ports do the same (SSH-2 only)”
- fill in a source port (that’s the remote port and will become the
:3389:
bit above) - fill in destination
127.0.0.1:3389
(that’s the local RDP port on your Windows machine) - tick “Remote”
- tick “Auto”
- click “Add” to get to the second screenshot
- Under connection:
- Ensure “Seconds between keepalives” is larger than zero (I took
1
) - Tick “Disable Nagle’s algorithm”
- Tick “Enable TCP keepalives”
- Tick “Attempt to reconnect on system wakup”
- Tick “Attempt to reconnect on connection failure”
- Ensure “Seconds between keepalives” is larger than zero (I took
- On the “SSH” tab:
- Do not enter a “Remote command” (seems unneeded on my system)
- Do not enter a “Remote command” (seems unneeded on my system)
So for now, I can do without things like:
- [WayBack] Google Code Archive – Long-term storage for Google Code Project Hosting.
- [WayBack] MobaXterm free Xserver and tabbed SSH client for Windows
–jeroen
Leave a Reply