相关文章推荐
另类的手链  ·  RegQueryValueExW 函数 ...·  1 年前    · 
悲伤的机器人  ·  java - ...·  1 年前    · 
耍酷的铁板烧  ·  Java - ...·  1 年前    · 

4. 修改防火墙权限

PS C:\Windows\system32> New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 19964
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                        : 已从存储区成功分析规则。 (65536)
EnforcementStatus             : NotApplicable
PolicyStoreSource             : PersistentStore
PolicyStoreSourceType         : Local
RemoteDynamicKeywordAddresses :

5. 重启ssh服务

PS C:\Windows\system32> net stop sshd
OpenSSH SSH Server 服务已成功停止。
PS C:\Windows\system32> net start sshd
OpenSSH SSH Server 服务正在启动 .
OpenSSH SSH Server 服务已经启动成功。

6. 在客户端进行连接

问题:无法连接,使用-v进行debug

C:\Users\reika>ssh -p 19964 1@<ip_address> -v
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to <ip_address> [<ip_address>] port 19964.
debug1: connect to address <ip_address> port 19964: Connection timed out
ssh: connect to host <ip_address> port 19964: Connection timed out

继续ping 远程主机,ping不通,最后发现是客户端网络问题,解决后正常连接。

输入exit退出连接。

7. ssh jump

C:\Users\reika>ssh -J <jump_username>@<jump_ip_address>:<jump_port> <username>@<ip_address>

推荐阅读 | 在家如何搞学术:远程桌面、ssh、跳板机攻略(针对Win10)