Skip to content

Instantly share code, notes, and snippets.

@TzuChiehHung
Last active December 27, 2022 15:52
Show Gist options
  • Save TzuChiehHung/b2f2d9e60628a3c018d13349f0ce1dd4 to your computer and use it in GitHub Desktop.
Save TzuChiehHung/b2f2d9e60628a3c018d13349f0ce1dd4 to your computer and use it in GitHub Desktop.
[Windows 10 OpenSSH Server Setup] #windows
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
# Set default shell
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment