Skip to content

Commit 9576973

Browse files
yarikopticclaude
andcommitted
BF: Use built-in OpenSSH on Windows Server 2025
Windows Server 2025 has OpenSSH pre-installed by default (unlike 2022). The old approach of downloading OpenSSH v7.6.1.0p1-Beta from 2018 and running install-sshd.ps1 conflicts with the built-in version. Now we just start the pre-installed sshd service. The firewall rule is also created automatically on Windows 2025. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 3f83a66 commit 9576973

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

.github/workflows/build-windows.yaml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -361,20 +361,12 @@ jobs:
361361
echo.127.0.0.1 datalad-test >> %SYSTEMROOT%\System32\drivers\etc\hosts
362362
echo.127.0.0.1 datalad-test2 >> %SYSTEMROOT%\System32\drivers\etc\hosts
363363
364-
- name: OpenSSH server setup
365-
shell: powershell
364+
- name: Start OpenSSH server
365+
shell: pwsh
366366
run: |
367-
mkdir downloads
368-
Invoke-WebRequest -Uri https://github.com/PowerShell/Win32-OpenSSH/releases/download/v7.6.1.0p1-Beta/OpenSSH-Win32.zip -OutFile downloads\openssh.zip
369-
7z x -o"downloads" downloads\openssh.zip
370-
371-
- name: Install
372-
shell: cmd
373-
run: powershell.exe -ExecutionPolicy Bypass -File downloads\OpenSSH-Win32\install-sshd.ps1
374-
375-
- name: Configure service
376-
shell: cmd
377-
run: powershell.exe New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
367+
# Windows Server 2025 has OpenSSH pre-installed, just need to start it
368+
Start-Service sshd
369+
Set-Service -Name sshd -StartupType 'Automatic'
378370
379371
- name: Keys in default place
380372
run: ssh-keygen -f ~/.ssh/id_rsa -N ""

.github/workflows/template/build-{{ostype}}.yaml.j2

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -673,20 +673,12 @@ jobs:
673673
echo.127.0.0.1 datalad-test >> %SYSTEMROOT%\System32\drivers\etc\hosts
674674
echo.127.0.0.1 datalad-test2 >> %SYSTEMROOT%\System32\drivers\etc\hosts
675675

676-
- name: OpenSSH server setup
677-
shell: powershell
676+
- name: Start OpenSSH server
677+
shell: pwsh
678678
run: |
679-
mkdir downloads
680-
Invoke-WebRequest -Uri https://github.com/PowerShell/Win32-OpenSSH/releases/download/v7.6.1.0p1-Beta/OpenSSH-Win32.zip -OutFile downloads\openssh.zip
681-
7z x -o"downloads" downloads\openssh.zip
682-
683-
- name: Install
684-
shell: cmd
685-
run: powershell.exe -ExecutionPolicy Bypass -File downloads\OpenSSH-Win32\install-sshd.ps1
686-
687-
- name: Configure service
688-
shell: cmd
689-
run: powershell.exe New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
679+
# Windows Server 2025 has OpenSSH pre-installed, just need to start it
680+
Start-Service sshd
681+
Set-Service -Name sshd -StartupType 'Automatic'
690682

691683
- name: Keys in default place
692684
run: ssh-keygen -f ~/.ssh/id_rsa -N ""

0 commit comments

Comments
 (0)