Difference between revisions of "Web/Get started with OpenSSH for Windows"

From PKC
Jump to navigation Jump to search
(Created page with "{{cite journal |title=Get started with OpenSSH for Windows |url=https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell |access-date=Jan 12, 2023 |publisher=Microsoft |location=local page }} <noinclude> {{PagePostfix |category_csd=VMWare,NAT,IP Addres,arp,sshd,OpenSSH,Windows }} </noinclude>")
 
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
}}
}}
<noinclude>
<noinclude>
<syntaxhighlight lang="SHELL" line>
# 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
‎</syntaxhighlight>
<syntaxhighlight lang="SHELL" line>
# 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. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
‎</syntaxhighlight>
{{PagePostfix
{{PagePostfix
|category_csd=VMWare,NAT,IP Addres,arp,sshd,OpenSSH,Windows
|category_csd=VMWare,NAT,IP Addres,arp,sshd,OpenSSH,Windows
}}
}}
</noinclude>
</noinclude>

Latest revision as of 12:27, 21 April 2023

"Get started with OpenSSH for Windows". local page: Microsoft. Retrieved Jan 12, 2023. 


# 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

# 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. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}

References


Related Pages