haoyunfeix / note

0 stars 0 forks source link

Install OpenSSH.Server on Windows #14

Open haoyunfeix opened 3 years ago

haoyunfeix commented 3 years ago
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

try gpedit.msc then;

Computer Configuration\Administrative Templates\System
Specify settings for optional component installation and component repair Enabled

Also check the box for

Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS)

# Start the sshd service
Start-Service sshd

# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'

# Confirm the firewall rule is configured. It should be created automatically by setup.
Get-NetFirewallRule -Name *ssh*

# There should be a firewall rule named "OpenSSH-Server-In-TCP", which should be enabled
# If the firewall does not exist, create one
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
haoyunfeix commented 3 years ago

https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement