Back to guides
Host setup

Windows (WSL2) Remote Login

Run SSH inside WSL2 and add the Linux environment as a Host.

Redock connects directly to the Linux environment inside WSL2. The SSH server, username, password, keys, paths, and login shell in this guide all belong to WSL, not Windows.

For the simplest LAN setup, use Windows 11 22H2 or later with WSL mirrored networking. Windows 10 and WSL NAT require separate port forwarding and are not covered here.

1. Install WSL2

Open PowerShell as Administrator:

wsl --install

Restart Windows if requested, open the installed Linux distribution, and create its Linux username and password. Confirm that the distribution uses WSL 2:

wsl --list --verbose

If VERSION is 1, run wsl --set-version <DistroName> 2.

2. Install SSH inside WSL

In Ubuntu or Debian inside WSL:

sudo apt update
sudo apt install -y openssh-server
sudo systemctl enable --now ssh
sudo systemctl status ssh --no-pager

Verify the Linux SSH session locally:

ssh localhost

Other distributions may use a different package manager or service name.

3. Allow LAN Access to WSL

In PowerShell, open %UserProfile%\.wslconfig:

notepad $env:USERPROFILE\.wslconfig

Add:

[wsl2]
networkingMode=mirrored

Then run PowerShell as Administrator:

wsl --shutdown
New-NetFirewallHyperVRule -Name 'RedockSSH' -DisplayName 'Redock SSH' -Direction Inbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -LocalPorts 22

Open the Linux distribution again after wsl --shutdown. WSL must be running when Redock connects; systemd services do not keep a stopped WSL instance alive.

4. Add the Host in Redock

Run ipconfig in PowerShell and use the IPv4 address of the active Wi-Fi or Ethernet adapter. Run whoami inside WSL for the Linux username.

Host: <Windows LAN IPv4 Address>
Port: 22
Username: <WSL Linux Username>
Connection Mode: SSH
Auth: WSL Password or SSH Key

For key authentication, add the public key to ~/.ssh/authorized_keys inside WSL. See SSH Authentication.

Common Issues

  • Connection timed out: Open the WSL distribution, check wsl --list --running, and confirm the Hyper-V firewall rule and LAN address.
  • Connection refused: Run sudo systemctl status ssh and sudo ss -lntp | grep ':22' inside WSL.
  • Authentication failed: Use the WSL Linux username and its password or authorized_keys, not Windows credentials.
  • SFTP works but the terminal closes: Run getent passwd $USER and confirm the account has a valid login shell, then verify that ssh localhost stays connected.
  • Port 22 is already in use: Configure another SSH port inside WSL and use the same port in the firewall rule and Redock Host.

Prefer an SSH key and a private network such as Tailscale for regular remote access.

Microsoft WSL installation guide

Microsoft WSL networking guide

Ubuntu OpenSSH Server guide

Try Redock while following this guide

Steer terminal coding agents on your own host, right from your phone.