고급 Windows

SSH Server/Client

개요

 Windows NT 1809 버전 이후 OpenSSH Server 설치를 네이티브로 지원한다.

GUI 기반 설치

설정 > 앱 >  앱 및 기능 > 선택적 기능 > 기능 추가에서

  • OpenSSH 클라이언트
  • OpenSSH 서버

두 요소를 설치한다.

자동으로 OpenSSH-Server-In-TCP 방화벽 규칙이 생성된다.

CLI 기반 설치

# Check for capability
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

# 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."
}

CLI 기반 제거

# Uninstall the OpenSSH Client
Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

# Uninstall the OpenSSH Server
Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

댓글

댓글 본문
버전 관리
loopback.kr
현재 버전
선택 버전
graphittie 자세히 보기