
1. The download link is as follows:https://github.com/PowerShell/Win32-OpenSSH/releases
2. Unzip the downloaded OpenSSH-Win64.zip to C:\Program Files\OpenSSH
3. Open PowerShell as an administrator and navigate to the unzipped directory:4. Run the installation script:
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
5. Modify the default port
6. Start the service, set it to start automatically, and check the listening port
Start-Service sshd
Set-Service -Name sshd -StartupType Automatic

7. Note: If there are issues with environment variables, running the installation script will result in the following error
8. Add environment variable
setx /M PATH "%PATH%;C:\Windows\System32\WindowsPowerShell\v1.0"
9. Generate keys on the Linux side
ssh-keygen -t ed25519
10. Create administrators_authorized_keys (if it does not exist)If this file does not exist, create it manually and set permissions:
New-Item -ItemType File "C:\ProgramData\ssh\administrators_authorized_keys"
Note: ProgramData is a hidden directory. If you cannot see it, you can copy the path to view it or search for ssh to find it.
11. Check permissions
icacls "C:\ProgramData\ssh\administrators_authorized_keys"

12. Set strict permissions (optional)
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
13. Copy the public key to Windows:
Method 1: Manually copy and paste into administrators_authorized_keys
cat ~/.ssh/id_ed25519.pub
Then paste it into C:\ProgramData\ssh\administrators_authorized_keys (one public key per line).
Method 2: Use ssh-copy-id
ssh-copy-id -i ~/.ssh/id_ed25519.pub username@windows_ip
14. Copy files from Linux to Windows
scp -P 16922 /etc/letsencrypt/live/xxx.xxx.cn/* [email protected]:C:/SSL

15. Automation (via cron scheduled tasks)
crontab -e
10 0 1,15 * * scp -P 16922 /etc/letsencrypt/live/xxx.xxx.cn/* [email protected]:C:/SSL