From 0d0b3a3389d946fdafc734a4d2e01563b59a6352 Mon Sep 17 00:00:00 2001 From: SwingURM Date: Sun, 22 Feb 2026 02:57:10 +0800 Subject: [PATCH 1/3] openssh: Add helper scripts to fix service binPath and autostart --- bucket/openssh.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bucket/openssh.json b/bucket/openssh.json index 2f39aebfb9eb0..122bdbd581382 100644 --- a/bucket/openssh.json +++ b/bucket/openssh.json @@ -41,9 +41,17 @@ } } }, + "post_install": [ + "$real = [IO.Directory]::ResolveLinkTarget($dir, $true).FullName; if (!$real) { $real = $dir }", + "$q = [char]34", + "Set-Content \"$dir\\fix.ps1\" @(\"sc.exe config sshd binPath= ${q}${real}\\sshd.exe${q}\", \"sc.exe config ssh-agent binPath= ${q}${real}\\ssh-agent.exe${q}\") -Encoding UTF8", + "Set-Content \"$dir\\autostart-sshd.ps1\" @('Set-Service sshd -StartupType Automatic', 'Set-Service ssh-agent -StartupType Automatic') -Encoding UTF8" + ], "notes": [ "Windows 10 or higher includes this build of OpenSSH in the system itself, hence it is recommended to use the system OpenSSH there.", "Run 'sudo $dir\\install-sshd.ps1' to install sshd and ssh-agent as a service.", - "Run 'sudo $dir\\uninstall-sshd.ps1' to uninstall the services." + "Run 'sudo $dir\\uninstall-sshd.ps1' to uninstall the services.", + "Run 'sudo $dir\\fix.ps1' to fix service binPath to absolute path.", + "Run 'sudo $dir\\autostart-sshd.ps1' to set sshd and ssh-agent to start automatically." ] } From 88940d9c136f473d9f93e44e0c1a03976ca72184 Mon Sep 17 00:00:00 2001 From: SwingURM Date: Sun, 22 Feb 2026 03:18:13 +0800 Subject: [PATCH 2/3] Get-Item --- bucket/openssh.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bucket/openssh.json b/bucket/openssh.json index 122bdbd581382..ef8963a954af0 100644 --- a/bucket/openssh.json +++ b/bucket/openssh.json @@ -42,7 +42,7 @@ } }, "post_install": [ - "$real = [IO.Directory]::ResolveLinkTarget($dir, $true).FullName; if (!$real) { $real = $dir }", + "$real = (Get-Item $dir -Force).Target; if (!$real) { $real = $dir }", "$q = [char]34", "Set-Content \"$dir\\fix.ps1\" @(\"sc.exe config sshd binPath= ${q}${real}\\sshd.exe${q}\", \"sc.exe config ssh-agent binPath= ${q}${real}\\ssh-agent.exe${q}\") -Encoding UTF8", "Set-Content \"$dir\\autostart-sshd.ps1\" @('Set-Service sshd -StartupType Automatic', 'Set-Service ssh-agent -StartupType Automatic') -Encoding UTF8" From 25be46292a6f27265066c310fb8a45ba0594af2c Mon Sep 17 00:00:00 2001 From: SwingURM Date: Wed, 25 Feb 2026 15:41:11 +0800 Subject: [PATCH 3/3] binPath --- bucket/openssh.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bucket/openssh.json b/bucket/openssh.json index ef8963a954af0..9fcf4309855ab 100644 --- a/bucket/openssh.json +++ b/bucket/openssh.json @@ -43,8 +43,7 @@ }, "post_install": [ "$real = (Get-Item $dir -Force).Target; if (!$real) { $real = $dir }", - "$q = [char]34", - "Set-Content \"$dir\\fix.ps1\" @(\"sc.exe config sshd binPath= ${q}${real}\\sshd.exe${q}\", \"sc.exe config ssh-agent binPath= ${q}${real}\\ssh-agent.exe${q}\") -Encoding UTF8", + "Set-Content \"$dir\\fix.ps1\" @(\"sc.exe config sshd binPath= ('`\"${real}\\sshd.exe`\"')\", \"sc.exe config ssh-agent binPath= ('`\"${real}\\ssh-agent.exe`\"')\") -Encoding UTF8", "Set-Content \"$dir\\autostart-sshd.ps1\" @('Set-Service sshd -StartupType Automatic', 'Set-Service ssh-agent -StartupType Automatic') -Encoding UTF8" ], "notes": [