0%

摘抄:ssh的ProxyJump

2020年1月13日 下午11:57

2020年2月14日 下午12:08

  1. 总结:ProxyJump是::一次性的::正向代理,如果写在了config中,可以重复使用
  2. 核心:ssh -o “ProxyJump 跳板机用户名@跳板机ip(或域名):跳板机端口” 目标服务器用户名@目标服务器ip(或域名)
  3. 配置文件方式穿越

ssh怎样通过代理登录远程主机 | Bruce’s Blog
::总结:使用ssh 失败的时候要时刻注意端口、ip、用户名,是否存在、开启访问、正确::

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 共同配置
vim .ssh/config
# Mac上.ssh/config的内容
Host 2001:cc0:2020:1032:4eed:fbff:fe91:c1e2
ProxyJump czh55@45.77.18.211
Host 2001:cc0:2020:1032:4eed:fbff:fe91:c29c
ProxyJump czh55@45.77.18.211

# titan
# ipv6 直接登录
ssh -p 22778 czh18@2001:****
# proxyJump 正向代理
ssh -o "ProxyJump czh55@45.***" -p 22** czh18@2001:**
# 本地正向代理,用于trasnport软件
ssh -f -N -L localhost:2000:localhost:22** -p 22** czh18@2001:**

# 2080-3
# ipv6 直接登录
ssh -p 22778 zhiheng_chen@2001:**
# proxyJump 正向代理
ssh -o "ProxyJump czh55@45.**" -p 22** zhiheng_chen@2001:**
# 本地正向代理,用于trasnport软件
ssh -f -N -L localhost:2001:localhost:22** -p 22** zhiheng_chen@2001:**
-ssh -p 2001 localhost -> ssh -p 22** zhiheng_chen@2001:**


# 网上的教程都没有考虑sshd和防火墙是否开放端口的事情
# centos7 防火墙
firewall-cmd --zone=public --list-ports
firewall-cmd --add-port=2222/tcp --permanent
firewall-cmd --reload

# sshd 重启
vim /etc/ssh/sshd_config
service sshd restart