DEV Community

Cover image for Remote SSH Access to Windows from Debian: Complete Setup and Fixes
Siddharth Magesh
Siddharth Magesh

Posted on

Remote SSH Access to Windows from Debian: Complete Setup and Fixes

Remote SSH Access to a Windows Machine from Debian: Full Setup, Fixes, and Lessons Learned

I wanted to remotely access my Windows laptop (with GPU) from my Debian machine using SSH. However, Windows 11 (especially Insider/Canary builds) often breaks or removes the built-in OpenSSH Server capability. This article documents every step needed to get SSH working correctly: installation, service creation, firewall rules, password setup, configuration fixes, and overcoming common errors.

This guide uses JohnDoe as the Windows username. Replace it with your own.


System Setup

  • Client machine: Debian Linux
  • Remote machine: Windows 11 (Canary build)
  • Goal: SSH from Debian into Windows using password authentication

1. Problem: OpenSSH Server Optional Feature Fails to Install

On Windows Canary builds, installing OpenSSH Server via:

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Enter fullscreen mode Exit fullscreen mode

often hangs indefinitely.
To avoid this issue, install OpenSSH manually.


2. Manual Installation of OpenSSH (MSI Method)

Download the official MSI:

OpenSSH-Win64-v10.0.0.0.msi
Enter fullscreen mode Exit fullscreen mode

Source: https://github.com/PowerShell/Win32-OpenSSH/releases/latest

Install it normally. After installation, binaries are located in:

C:\Program Files\OpenSSH\
Enter fullscreen mode Exit fullscreen mode

3. Create the SSH Service Manually

On some Windows builds, the MSI installs binaries but does not register the sshd service.
Create it using sc.exe.

Open PowerShell as Administrator:

sc.exe create sshd binPath= "C:\Program Files\OpenSSH\sshd.exe" start= auto
sc.exe description sshd "OpenSSH SSH Server"
Start-Service sshd
Enter fullscreen mode Exit fullscreen mode

Verify service state:

Get-Service sshd
Enter fullscreen mode Exit fullscreen mode

Verify startup:

Get-CimInstance -ClassName Win32_Service -Filter "Name='sshd'" | Select-Object Name, StartMode, State
Enter fullscreen mode Exit fullscreen mode

Expected:

Name   StartMode  State
sshd   Auto       Running
Enter fullscreen mode Exit fullscreen mode

4. Allow SSH Through Windows Firewall

New-NetFirewallRule -Name sshd -DisplayName "OpenSSH Server" -Enabled True -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow
Enter fullscreen mode Exit fullscreen mode

5. Determine Windows Local IP Address

ipconfig
Enter fullscreen mode Exit fullscreen mode

Look for the IPv4 address of the active adapter, for example:

IPv4 Address: 192.168.68.103
Enter fullscreen mode Exit fullscreen mode

Use this IP when connecting from Debian.


6. Set a Password for the Windows User (Required for SSH)

If your account only uses PIN/face/fingerprint, SSH cannot authenticate.
A real password must be set.

net user JohnDoe *
Enter fullscreen mode Exit fullscreen mode

Enter a password when prompted.
This is the password that SSH will use.


7. SSH Configuration Fixes (Optional but Recommended)

Open:

notepad "C:\Program Files\OpenSSH\sshd_config"
Enter fullscreen mode Exit fullscreen mode

Ensure the following lines exist and are not commented:

PasswordAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
Enter fullscreen mode Exit fullscreen mode

If this block exists, comment it out to avoid override issues:

#Match Group administrators
#    AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
Enter fullscreen mode Exit fullscreen mode

Restart the service:

Restart-Service sshd
Enter fullscreen mode Exit fullscreen mode

8. (Optional) Add SSH Key Authentication

On Debian:

ssh-keygen -t ed25519 -C "debian-client"
cat ~/.ssh/id_ed25519.pub
Enter fullscreen mode Exit fullscreen mode

On Windows:

mkdir $env:USERPROFILE\.ssh -Force
notepad $env:USERPROFILE\.ssh\authorized_keys
Enter fullscreen mode Exit fullscreen mode

Paste the key and save.

Set valid ACL permissions:

cmd /c 'icacls "C:\Users\JohnDoe\.ssh" /inheritance:r'
cmd /c 'icacls "C:\Users\JohnDoe\.ssh" /grant JohnDoe:(F)'
cmd /c 'icacls "C:\Users\JohnDoe\.ssh\authorized_keys" /inheritance:r'
cmd /c 'icacls "C:\Users\JohnDoe\.ssh\authorized_keys" /grant JohnDoe:(R)'
Enter fullscreen mode Exit fullscreen mode

9. SSH From Debian

ssh JohnDoe@192.168.68.103
Enter fullscreen mode Exit fullscreen mode

When prompted for host authenticity, enter:

yes
Enter fullscreen mode Exit fullscreen mode

Then provide the password created via net user.


10. Notes and Hurdles Encountered

OpenSSH capability installation hanging

The built-in feature installer may freeze on Canary builds.
The MSI avoids this entirely.

Service missing after reboot

If the service shows “marked for deletion”, reboot and recreate using sc.exe.

Authentication failures

If SSH keeps asking for a password, ensure:

  • The Windows user has a real password
  • PasswordAuthentication yes is set
  • sshd is restarted

Public key not accepted

Verify:

  • The file is named authorized_keys (no extension)
  • ACL permissions are correct
  • AuthorizedKeysFile path matches

Also, All my accounts on the browser were logged out.


Conclusion

SSH access from Linux to Windows is entirely possible, even on unstable Windows builds, but may require manual installation steps and fixes. Following the process above provides a stable, repeatable configuration with accurate commands and known troubleshooting solutions.

This article may be updated later to include additional remote access enhancements such as Parsec, TeamViewer, RustDesk, and Wake-on-LAN.

Top comments (0)