Contents

Windows Remote Development Tips

Port Forwarding (Tunnel) With SSH

1
ssh -L local_port:remote_host:remote_port username@jump_host -N -f

Arguments (see man page):

  • -L [bind_address:]port:host:hostport: Which port to forward
  • -N: Executes no command, creating a shell that’s just forwarding the port. It’ll look like it’s hanging.
  • -f: Put ssh process in background

Remote Development Through a Jump Host

Remote Machine Setup

  • Go into the Developer Settings (search for it in the Start Menu), and then enable all of the Remote Desktop options
  • Follow the guide here to install OpenSSH server on the remote machine, which will also include scp

Windows Remote Desktop

The Windows Remote Desktop port is 3339 by default. You can forward this port through your jump host, and then create a remote desktop connection to the port you’ve opened locally. Any of the following options should work.

1
2
3
4
5
6
7
8
# Explicit IPV4 address for jump host
ssh -L 13339:123.123.123.123:3339 username@jump_host -N -f

# Explicit IPV6 address for jump host (IP from Wikipedia)
ssh -L 13339:[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:3339 username@jump_host -N -f

# Using Windows environment variable to get your own username
ssh -L 13339:123.123.123.123:3339 $env:USERNAME@jump_host -N -f

Then, you can create a Remote Desktop connection to the port you’ve opened locally (configuring username as appropriate).

static/Pasted%20image%2020221216153111.png

You can also forward local drives (from the client to the remote machine), such that the client’s drive is available for transparent local access on the remote machine. Be warned that the transfer speeds may not be fantastic, though, and you may be better off with another solution (from below).

static/Pasted%20image%2020230221024020.png

Transferring Files (With SCP)

This website has some more details / options. I’ve listed the two I found most useful below.

Single Command Transfer

1
scp -J username@jump_host FILE_TO_COPY username@remote_host:REMOTE_PATH

This will prompt you for a password to log in to the jump_host, which may not be a problem if you’ve set up passwordless ssh, but could become annoying if you have additional authentication on the jump host, such as via 2fa. If so, consider the next option.

Persistent Transfer Tunnel

In one terminal, open a tunnel to port 22:

1
ssh -L 4242:remote_host:22 username@jump_host -N -f

Then, in another terminal, scp via the port you just forwarded (4242 for the command above):

1
scp -P 4242 FILE_TO_COPY remote_username@localhost:REMOTE_PATH

SOCKS Proxy

Install Proxy SwitchyOmega.

Then, forward some port with dynamic forwarding (-D):

1
ssh -nNT -C -D 8124 username@jump_host

As before, this will not produce any output after connection, so it’ll look like its hanging. Once this is initialized, though, you should be able to use the Chrome extension to proxy traffic through port 8124, as below:

static/Pasted%20image%2020230221025734.png

Visual Studio Code (VS Code)

CTRL + Shift + P, edit remote SSH settings for the user, and then update remote.ssh.serverinstallpath to point to a different directory for the vscode server, using the ssh config names.

  • Windows terminal, set the splits to be ctrl +\ and ctrl +- for split-right and split-down respectively

user settings vim:

1
2
3
4
5
6
    "vim.insertModeKeyBindingsNonRecursive": [
        {
            "before": ["k", "j"],
            "after": ["<Esc>"]
        }
    ]