Anydesk is usually used for accessing remote desktop, viz. the entire GUI shell. This, however, uses a lot of data. If one wants to simply run commands remotely, then it's more efficient to use SSH by using Anydesk's TCP tunneling feature. TCP tunnelling also gives access to remote's network provided a SQUID web proxy is running @ remote, thus setting up a VPN effectively. Anydesk offers only one TCP tunneling in its FREE license.
To set up SSH, for example, to a Remote Linux server do the following:
- Setup Anydesk server in remote. Make sure
Create TCP tunnels
is checked in Settings > Permissions. - Open Anydesk client in your Windows computer.
- Sign in to your Anydesk Account, otherwise TCP tunneling would be greyed out.
- Connect to Remote in the Anydesk app and set up TCP tunneling. Say, we forward local port 22221 to remote port 22.
- Open
cmd.exe
and SSH to Remote:ssh <remote_user>@localhost -p 22221
. - To save data, when connecting to Remote in the Anydesk app, use the
Browse Files
mode, not the fullConnect
mode.
To SSH to Remote from WSL2:
- Forward another Windows port, say, 22222 to localhost:22221 using the Powershell command:
netsh interface portproxy add v4tov4 listenport=22222 listenaddress=0.0.0.0 connectport=22221 connectaddress=localhost
. Effectively now, Anydesk listens to localhost:22222 and accepts connections from all IPs, by virtue oflistenaddress=0.0.0.0
. Step 4 above may not in itself ensure such aceeptance of incoming connections from all IPs. - SSH to Windows:22222 from WSL2 by following the steps mentioned here.
- Setup an ssh-host-alias for convenience.
Setting up SSH from WSL2 is important in case one wants to use nautilus
in WSL2 to work with (i.e. move, copy, rename, edit, view etc.) files in Remote. Nautilus looks and feels better than the native Browse Files
utility in Anydesk. To set up nautilus
like that do:
- Install
nautilus
in WSL2:sudo apt install nautilus -y
- Install
gvfs-backends
:sudo apt install gvfs-backends
- Install
gvfs-fuse
:sudo apt install gvfs-fuse
- Install
gvfs-smb
:sudo apt install gvfs-smb
wsl --shutdown
in Powershell or cmd.exe.- Relaunch WSL2 >
nautilus
or simply Files(Ubuntu) from the Windows Start menu. Ctrl+L
orOther Locations
>Connect to Server
tosftp://<remote-user>@<Win_IP>:22222
Another option is to use WinSCP connecting to sftp://<remote-user>@localhost:22221
N.B: If the newest version (in Windows) doesn't support TCP tunnelling, fall back to earlier versions. I tested with v6.2 on both Windows and Linux.