easyice

OpenSSH config on windoze

Aug 25th, 2025 (edited)
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # from https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell&pivots=windows-10...
  2.  
  3. Start-Service sshd
  4.  
  5. # OPTIONAL but recommended:
  6. Set-Service -Name sshd -StartupType 'Automatic'
  7.  
  8. # Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
  9. if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
  10.     Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
  11.     New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
  12. } else {
  13.     Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
  14. }
Advertisement
Add Comment
Please, Sign In to add comment