Fixing OpenSSH Server on Windows

Zhimin Wen
1 min readOct 23, 2024
Image by Moshe Harosh from Pixabay

I am using SSH service on Windows as a jump box to access Linux servers. It was working fine until recently the SSH session breaks suddenly.

Today, the SSH service could not be up at all after some force restart for patches. Frustrated by multiple reboot, missing logs, ssh process working fine but the service always gives a error of 1067…

Its time to ditch the default version and upgrade to the latest.

  1. Remove the Windows Feature OpenSSH. Restart required :(
  2. Download the 64 bit zip file from https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v9.8.1.0p1-Preview
  3. Extract the zip file with the normal user
  4. Open a Administrator privilege Powershell session, copy the extracted OpenSSH-Win64/ directory into C:\Program Files
  5. cd into the C:\Program Files\OpenSSH-Win64, fixing the permissions

powershell.exe -ExecutionPolicy Bypass -File FixHostFilePermissions.ps1

6. Install OpenSSH as a service

powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1

7. Enable firewall for port 22

New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

8. Set service as auto start

Set-Service sshd -StartupType Automatic

Start the OpenSSH service, its working fine.

--

--

Responses (1)