Android Remote Desktop connection via SSH

Microsoft provides its RemoteDesktop client for major OSs including smart devices.
You can add a secure tunnel with SSH to RDP service.

Pre-requisites

Before starting, you need to have SSH server & client installation.

  • OpenSSH server setup
    • You can use Windows official OpenSSH server or other network proxy solutions.
  • Termux on Android
    • You can obtain termux from F-droid channel.
    • openssh package on Termux also required.

Termux is mostly same as Linux console.
Add SSH connection entry to ~/.ssh/config as follows:

Host <FriendlyName>
HostName <Global Host for SSH>
Port <SSH server port>
User <Windows Login User name>
IdentityFile <Path to private key file>

You can learn more detail from OpenSSH references.

Create SSH tunnel

Every time connecting to Remote desktop, create SSH tunnel on Termux:

$ ssh -L 3389:localhost:3389 <FriendlyName>

This command redirects remote 3389 port to local 3389 port.
3389 is the default RDP service port.

If everything goes well, you will see the command prompt on the remote host.
This behavior is the same as usual SSH login.

After that, switch to RemoteDesktop App. Termux still works as a background process.
Now you can connect to Remote desktop, but its Host setting should be localhost. Other settings are usual Windows configurations.

RemoteDesktop App connects to port 3389 on the specified host, so localhost connection will be redirected to the original desktop host.

On closing Remote Desktop, you can also close Termux app.

⁋ Oct 16, 2022↻ Nov 7, 2024
中馬崇尋
Chuma Takahiro