— Cài đặt OpenSSH sử dụng PowerShellYêu cầu: Windows Server 2019 và Windows 10 1809 (or later)Mở PowerShell với quyền Administrator@Kiểm tra xem tính năng OpenSSH đã được hỗ trợ trên OS hiện tại chưa
PS C:\Users\thiennl> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
Name : OpenSSH.Client~~~~0.0.1.0
State : NotPresent
Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
@Cài đặt OpenSSH (Server/Client)
PS C:\Users\thiennl> Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Path :
Online : True
RestartNeeded : False
PS C:\Users\thiennl> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Path :
Online : True
RestartNeeded : False
@Kiểm tra trạng thái OpenSSH sau khi cài đặt
PS C:\Users\thiennl> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
Name : OpenSSH.Client~~~~0.0.1.0
State : Installed
Name : OpenSSH.Server~~~~0.0.1.0
State : Installed
@Cấu hình SSH Server
#Start dịch vụ
PS C:\Users\thiennl> Start-Service sshd
#Khởi động dịch vụ cùng HĐH
PS C:\Users\thiennl> Set-Service -Name sshd -StartupType 'Automatic'
#Kiểm tra firewall allow ssh
PS C:\Users\thiennl> Get-NetFirewallRule -Name *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 : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
@Cấu hình firewall allow ssh (nếu chưa có)
PS C:\Users\thiennl> New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
Name : sshd
DisplayName : OpenSSH Server (sshd)
Description :
DisplayGroup :
Group :
Enabled : True
Profile : Any
Platform : {}
Direction : Inbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
— Test ssh windows
[root@dinguyen ~]# ssh thiennl@172.17.16.1
The authenticity of host '172.17.16.1 (172.17.16.1)' can't be established.
ECDSA key fingerprint is SHA256:50GYguyCeMT05GqgSypn5a+V5ljUgJKbuRqCcG2uTko.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.17.16.1' (ECDSA) to the list of known hosts.
thiennl@172.17.16.1's password:
Microsoft Windows [Version 10.0.19042.746]
(c) 2020 Microsoft Corporation. All rights reserved.
0 comments:
Post a Comment