Skip to content

Instantly share code, notes, and snippets.

@ph20
Created February 9, 2024 16:54
Show Gist options
  • Save ph20/a6ece6b56f5da272aa7ade215340ad9a to your computer and use it in GitHub Desktop.
Save ph20/a6ece6b56f5da272aa7ade215340ad9a to your computer and use it in GitHub Desktop.
Install ssh server on windows
# enable/instgall sshd server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Start the SSH service
Start-Service sshd
# OPTIONAL: Set the SSH service to start automatically
Set-Service -Name sshd -StartupType 'Automatic'
# Add a firewall rule to allow SSH connections
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
# Check the SSH service status
Get-Service sshd
# Confirm the OpenSSH Server feature is installed
Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Server*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment