KARAF / karaf star
2022-12-17
Open
#10 윈도우 SSH 서비스 설치 star
2022-12-17 Open
Tasks

OpenSSH 서버 활성화#

PS C:\Users\ssemiya> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0                                                                                                                                                                
Path          :
Online        : True
RestartNeeded : False

sshd 서비스 실행#

PS C:\Users\ssemiya> Start-Service sshd

부팅 시점에 자동 서비스 실행#

PS C:\Users\ssemiya> Set-Service -Name sshd -StartupType 'Automatic'

방화벽 설정: 22번 외부 접속 허용#

PS C:\Users\ssemiya> Get-NetFirewallRule -Name OpenSSH-Server-In-TCP


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
RemoteDynamicKeywordAddresses : {}

방화벽 직접 추가#

PS C:\Users\ssemiya> New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH-Server-In-TCP' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22


Name                          : sshd
DisplayName                   : OpenSSH-Server-In-TCP
Description                   :
DisplayGroup                  :
Group                         :
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
RemoteDynamicKeywordAddresses : {}

테스트#

  • 클라이언트 사용
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
PS C:\Users\ssemiya> ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command]
PS C:\Users\ssemiya> ipconfig

Windows IP 구성


알 수 없는 어댑터 로컬 영역 연결:

   미디어 상태 . . . . . . . . : 미디어 연결 끊김
   연결별 DNS 접미사. . . . :

이더넷 어댑터 이더넷:

   미디어 상태 . . . . . . . . : 미디어 연결 끊김
   연결별 DNS 접미사. . . . :

알 수 없는 어댑터 McAfee VPN:

   미디어 상태 . . . . . . . . : 미디어 연결 끊김
   연결별 DNS 접미사. . . . :

무선 LAN 어댑터 로컬 영역 연결* 1:

   미디어 상태 . . . . . . . . : 미디어 연결 끊김
   연결별 DNS 접미사. . . . :

무선 LAN 어댑터 로컬 영역 연결* 2:

   미디어 상태 . . . . . . . . : 미디어 연결 끊김
   연결별 DNS 접미사. . . . :

무선 LAN 어댑터 Wi-Fi:

   연결별 DNS 접미사. . . . :
   링크-로컬 IPv6 주소 . . . . : fe80::3584:9c78:90c2:9e4c%14
   IPv4 주소 . . . . . . . . . : 192.168.1.232
   서브넷 마스크 . . . . . . . : 255.255.255.0
   기본 게이트웨이 . . . . . . : 192.168.1.1

이더넷 어댑터 Bluetooth 네트워크 연결:

   미디어 상태 . . . . . . . . : 미디어 연결 끊김
   연결별 DNS 접미사. . . . :
PS C:\Users\ssemiya>
PS C:\Users\ssemiya>
PS C:\Users\ssemiya\.ssh> Invoke-Item C:\ProgramData\ssh\sshd_config
PS C:\Users\ssemiya\.ssh> restart-service -name sshd -force
Issue Sharer
Comment 0

Add a comment
New subtask
Assignee
No assignee
Due date
No due date
Label
windows
Comment 0