This repository has been archived on 2026-07-09. You can view files and clone it, but cannot push or open issues or pull requests.
agent-knowledge-base-archived/skills/windows-remote-access-baseline.md

5.3 KiB

Windows Remote Access Baseline

Purpose

Prepare a Windows garage project computer for agent control through SSH and remote desktop through TightVNC Server, without storing credentials in Git.

Verified Reference

Verified on wuu on 2026-05-24:

  • TightVNC Server 2.8.87 installed through winget package GlavSoft.TightVNC.
  • TightVNC service tvnserver runs automatically and listens on TCP 5900 and 5800.
  • Handshake on 192.168.1.192:5900 and 10.8.1.57:5900 advertises VNCAuth, not unauthenticated None.
  • The user set the primary VNC password interactively outside Git.

Verified on pump after correction on 2026-05-24:

  • OpenSSH Server installed and running automatically.
  • SSH listens on TCP 22.
  • Key login to post@localhost and post@192.168.1.39 works after adding the public key to C:\ProgramData\ssh\administrators_authorized_keys.
  • TigerVNC viewer 1.16.2 installed at C:\Program Files\TigerVNC\vncviewer.exe.
  • TightVNC Server 2.8.87 installed through winget package GlavSoft.TightVNC.
  • TightVNC service tvnserver runs automatically and listens on TCP 5900 and 5800.
  • TigerVNC WinVNC server was the wrong initial server choice on pump; its service is stopped and disabled.
  • Handshake on 192.168.1.39:5900 returns RFB 003.008 and advertises VNCAuth,Tight, not unauthenticated None.

OpenSSH Setup

Run from an elevated PowerShell:

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Set-Service sshd -StartupType Automatic
Start-Service sshd
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
New-NetFirewallRule -Name OpenSSH-Server-In-TCP -DisplayName "OpenSSH Server (sshd)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

For local administrator accounts, Windows OpenSSH usually ignores C:\Users\<user>\.ssh\authorized_keys because the default sshd_config has:

Match Group administrators
       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

Copy only public keys into C:\ProgramData\ssh\administrators_authorized_keys, then restrict ACLs:

$adminKeys = "$env:ProgramData\ssh\administrators_authorized_keys"
New-Item -ItemType Directory -Force -Path (Split-Path $adminKeys) | Out-Null
Get-Content "$env:USERPROFILE\.ssh\authorized_keys" | Set-Content $adminKeys -Encoding ascii
icacls $adminKeys /inheritance:r
icacls $adminKeys /grant "SYSTEM:F" "Administrators:F"
icacls $adminKeys /remove "Users" "Authenticated Users" "Everyone"
Restart-Service sshd

Do not commit private keys. Public keys may be documented or stored in locations/ssh-public-keys/ when useful.

TightVNC Server Setup

Use this as the Windows garage VNC server baseline:

winget install --id GlavSoft.TightVNC --exact --accept-package-agreements --accept-source-agreements --silent
Set-Service tvnserver -StartupType Automatic
Start-Service tvnserver
New-NetFirewallRule -Name TightVNC-Server-In-TCP -DisplayName "TightVNC Server (5900)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 5900
New-NetFirewallRule -Name TightVNC-Http-In-TCP -DisplayName "TightVNC Web Access (5800)" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 5800
Start-Process "C:\Program Files\TightVNC\tvnserver.exe" -ArgumentList "-configservice"

In the TightVNC Service Configuration window:

  • keep Accept incoming connections enabled;
  • keep Require VNC authentication enabled;
  • set a primary password outside Git;
  • optionally set a control password outside Git;
  • apply and restart the tvnserver service if needed.

Notes:

  • 127.0.0.1:5900 may reject with Sorry, loopback connections are not enabled; test through the LAN/VPN address instead.
  • Short/simple passwords are easy for local calibration work but weak for exposed networks. Keep VNC restricted to trusted LAN/VPN/firewall scopes.
  • Do not paste or commit TightVNC passwords.

TigerVNC Viewer

The Windows winget package TigerVNC.TigerVNC installs the viewer only. Install it when the machine needs to connect to other VNC hosts:

winget install --id TigerVNC.TigerVNC --exact --accept-package-agreements --accept-source-agreements --disable-interactivity

Do not install TigerVNC WinVNC server as the standard Windows VNC server for the garage project. It was installed on pump first, but the user corrected the standard to TightVNC Server after the other computers used TightVNC successfully.

Verification

Get-Service sshd,ssh-agent,TigerVNC,tvnserver -ErrorAction SilentlyContinue
Get-NetTCPConnection -State Listen -LocalPort 22,5900,5800 -ErrorAction SilentlyContinue
ssh -i <PRIVATE_KEY_PATH> -o IdentitiesOnly=yes -o BatchMode=yes post@<HOST_OR_IP> hostname

For VNC, verify at minimum that TCP 5900 listens and that the server does not advertise unauthenticated None security. A real remote-control verification still requires the VNC password, which must remain outside this repository.

Service Recovery

For unattended garage machines, configure restart recovery for OpenSSH and TightVNC from an elevated shell:

sc.exe failure sshd reset= 86400 actions= restart/60000/restart/60000/restart/60000
sc.exe failureflag sshd 1
sc.exe failure tvnserver reset= 86400 actions= restart/60000/restart/60000/restart/60000
sc.exe failureflag tvnserver 1

Verified on pump on 2026-05-24.