Windows

Win10

SSH 서비스 설치

홍사훈     0건     1,803회

본문

[SSH Server 작업]

1. 설치 방법 1 (앱 및 기능에서)

1.1 [앱 및 기능] → [선택적 기능]

 509e3423befae3a7e5f4d5a9ff26c6e3_1624702 


1.2 선택적 기능에서 OpenSSH 서버 설치

 509e3423befae3a7e5f4d5a9ff26c6e3_1624702 


2. 설치 방법 2 (PowerShell에서 설치)

Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.

 

새로운 크로스 플랫폼 PowerShell 사용 https://aka.ms/pscore6

 

PS C:\WINDOWS\system32> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*' ---- SSH Client 설치

Name  : OpenSSH.Client~~~~0.0.1.0

State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0

State : NotPresent

PS C:\WINDOWS\system32> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 ---- SSH 서버 설치 명령어

Path          :

Online        : True

RestartNeeded : False

PS C:\WINDOWS\system32> Start-Service sshd ---- SSH 서비스 시작

PS C:\WINDOWS\system32> Set-Service -Name sshd -StartupType 'Automatic' ---- 윈도우 시작시 SSH 서버가 자동으로 시작

PS C:\WINDOWS\system32> Get-NetFirewallRule -Name *ssh* ---- SSH 방화벽 설정 확인

Name                  : OpenSSH-Server-In-TCP

DisplayName           : OpenSSH SSH Server (sshd)

Description           : Inbound rule for OpenSSH SSH Server (sshd)

DisplayGroup          : OpenSSH Server

Group                 : OpenSSH Server

Enabled               : True

Profile               : Any

Platform              : {}

Direction             : Inbound

Action                : Allow

EdgeTraversalPolicy   : Block

LooseSourceMapping    : False

LocalOnlyMapping      : False

Owner                 :

PrimaryStatus         : OK

Status                : 저장소에서 규칙을 구문 분석했습니다. (65536)

EnforcementStatus     : NotApplicable

PolicyStoreSource     : PersistentStore

PolicyStoreSourceType : Local

 

PS C:\WINDOWS\system32> New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

---- SSH 방화벽에 추가 없는경우에만 할것 (미확인)

 

PS C:\WINDOWS\system32> netstart -na | findstr 22 ---- 포트 확인

  TCP    0.0.0.0:22             0.0.0.0:0              LISTENING

  TCP    192.168.0.20:22        192.168.0.26:2793      ESTABLISHED

  TCP    [::]:22                [::]:0                 LISTENING

  UDP    127.0.0.1:62244        *:*

PS C:\WINDOWS\system32>

 

3. SSH 서비스 시작

Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.

 

새로운 크로스 플랫폼 PowerShell 사용 https://aka.ms/pscore6

 

PS C:\WINDOWS\system32> get-service sshd ---- 서비스 동작 여부 확인

 

Status   Name               DisplayName

------   ----               -----------

Stopped  sshd               OpenSSH SSH Server

 

PS C:\WINDOWS\system32> start-service sshd ---- 서비스 시작

PS C:\WINDOWS\system32> 

PS C:\WINDOWS\system32> get-service sshd

 

Status   Name               DisplayName

------   ----               -----------

Running  sshd               OpenSSH SSH Server

 

PS C:\WINDOWS\system32> Stop-service sshd ---- 서비스 종료

PS C:\WINDOWS\system32>

PS C:\WINDOWS\system32> get-service sshd

 

Status   Name               DisplayName

------   ----               -----------

Stopped  sshd               OpenSSH SSH Server

 

PS C:\WINDOWS\system32> 

PS C:\WINDOWS\system32>

 

[SSH Client에서 서버 접속] 

 

Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.


새로운 크로스 플랫폼 PowerShell 사용 https://aka.ms/pscore6


PS C:\Windows\system32> ssh sahoon@192.168.0.100

The authenticity of host '192.168.0.100 (192.168.0.100)' can't be established.

ECDSA key fingerprint is SHA256:P2Iq4e41XECoOwCRI9Ej3t7cFPY6ZLGzLi.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added '192.168.0.100' (ECDSA) to the list of known hosts.

sahoon@192.168.0.100's password:

Microsoft Windows [Version 10.0.19042.985]

(c) Microsoft Corporation. All rights reserved.


sahoon@DESKTOP C:\Users\sahoon>

 

등록된 댓글이 없습니다.



Copyrightⓡ1996~2025, sahoon.com All Rights Reserved.