DEV Community

Edward - dev
Edward - dev

Posted on Originally published at 4nuva.dev

Run PowerShell, Command Prompt and Git Bash on your Windows PC from your phone

Originally published at Agent Terminal's blog.

There are three ways to do it. Only one keeps your shell running when your phone disconnects.

Best for When the phone disconnects Cost
1. OpenSSH Server Quick commands on your home Wi-Fi Session ends Free
2. OpenSSH + mesh VPN The same, from anywhere Session still ends Free for personal use
3. A host app Builds, scripts and agents you walk away from Session keeps running on the PC Free and self-sustained on your own Wi-Fi

1. OpenSSH Server

OpenSSH Server is the SSH server built into Windows 10 (build 1809) and later. Turn it on and any SSH app on your phone can open a shell on the PC over your home Wi-Fi: Command Prompt by default, or PowerShell or Git Bash. The catch: the shell belongs to the connection, so when your phone locks or switches network, the shell ends. tmux, the usual fix, has no native Windows version. Its install guide covers Linux and macOS; on Windows it runs inside WSL, or through MSYS2 or Cygwin.

Setup steps

  1. Settings → search Optional features → add OpenSSH Server.
  2. In an admin PowerShell: Start-Service sshd and Set-Service -Name sshd -StartupType 'Automatic'.
  3. Land in PowerShell 7 instead of Command Prompt:
   New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe" -PropertyType String -Force
Enter fullscreen mode Exit fullscreen mode

For Git Bash, use C:\Program Files\Git\bin\bash.exe as the value.

  1. Connect from your phone's SSH app to the PC's local IP on port 22. Use a key, not a password.

Source: Microsoft's OpenSSH setup guide and server configuration page.

2. Add a mesh VPN

A mesh VPN such as Tailscale puts your PC and phone on one private network, so Option 1 works from anywhere without opening a port to the internet. Tailscale's Personal plan is free for non-commercial use. The catch: it changes where you can connect from, not what happens when you disconnect.

3. A host app

A host app runs the shells on the PC and lets your phone attach and detach. Agent Terminal works this way on Windows and macOS: download it, click the phone icon, scan the QR code.

Diagram on the original post: where the shell session lives. With SSH (Options 1 and 2), the shell belongs to the connection and ends when it drops. With a host app (Option 3), the shell belongs to a host process on the PC, and the phone only attaches to it, so when the phone drops the shell is still running.

Why the session survives in Option 3: the phone attaches to a shell the PC owns.

Your phone sees every PowerShell, Command Prompt, Git Bash and WSL tab on the PC, and gets a notification when a long command finishes. It is still SSH underneath, with keys only (how to check). Free and self-sustained on your own Wi-Fi. Away from home, the free plan relies on n0's public relays, best effort and not guaranteed; Pro gives you remote access you can rely on (plans).

Compared

OpenSSH + mesh VPN Host app
Away from home No Yes Best effort through n0's public relays; dependable with Pro (plans)
Survives a disconnect No No Yes
Notifies when done No No Yes
Pieces to maintain 2 4 2

Questions

Can I run tmux on Windows?

Not natively. You can run it inside WSL, or through the MSYS2 and Cygwin packages. WSL’s tmux keeps a Linux shell alive rather than your PowerShell, Command Prompt or Git Bash session.

Is it safe to turn on OpenSSH Server?

Windows opens port 22 for it. Behind a home router that is not forwarding the port, only your own network can reach it. Use keys, and never forward port 22 to the internet.

Do I need OpenSSH or a VPN for Agent Terminal?

No. The desktop app is the SSH server, and pairing is one QR scan.


Checked against Microsoft, Tailscale and tmux documentation on 20 October 2026. Written by Edward, from the team that builds Agent Terminal.

Top comments (0)