29
2023
04
13:15:15

Install Win32 OpenSSH using WinGet

https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH

Install using WinGet

Starting with GitHub Release 8.9.1.0, OpenSSH Beta releases are available through WinGet. With WinGet installed on the machine, use the following commands:

  • Search:
    winget search "openssh beta"

  • Install:
    winget install "openssh beta"

  • Uninstall:
    winget uninstall "openssh beta"

Install Win32 OpenSSH (test release)

  1. Win32-OpenSSH Github releases can be installed on Windows 7 and up.

  2. Note these considerations and project scope first.

  3. Download the latest build of OpenSSH. To get links to latest downloads this wiki page.

  4. Extract contents of the latest build to C:\Program Files\OpenSSH (Make sure binary location has the Write permissions to just to SYSTEM, Administrator groups. Authenticated users should and only have Read and Execute.)

  5. In an elevated Powershell console, run the following

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

  6. Open the firewall for sshd.exe to allow inbound SSH connections

    Note: New-NetFirewallRule is for Windows 2012 and above servers only. If you're on a client desktop machine (like Windows 10) or Windows 2008 R2 and below, try:

    netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22
    • New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

  7. Start sshd (this will automatically generate host keys under %programdata%\ssh if they don't already exist)

    • net start sshd

  8. Optional

    • Set-Service sshd -StartupType Automatic

    • To configure a default shell, see here

    • To setup sshd service to auto-start

    • To migrate sshd configuration from older versions (0.0.X.X), see here

Uninstall Win32 OpenSSH

  • Start Windows Powershell as Administrator

  • Navigate to the OpenSSH directory

    • cd 'C:\Program Files\OpenSSH'

  • Run the uninstall script

    • powershell.exe -ExecutionPolicy Bypass -File uninstall-sshd.ps1




推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

本文链接:https://hqyman.cn/post/4024.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:
打赏





休息一下~~


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

请先 登录 再评论,若不是会员请先 注册

您的IP地址是: