ssh 跳板機 ProxyCommand
阿新 • • 發佈:2018-08-24
ide sts keys proxy 8.0 con 目錄 ldo 機器 A 本地機器
B 跳板機
C 實際服務器
B 跳板機
C 實際服務器
A 與B 做無密碼認證, B與C 做無密碼認證 ,
keyfile_bastion 是A與B的私鑰
keyfile_internal 是B與C的私鑰
以root用戶為例
A 在 /root/.ssh/config 目錄配置文件內容
Host internal1.example.com internal2.example.com User root Port 22 IdentityFile=./keyfile_internal ProxyCommand ssh -qaY -i .ssh/keyfile_bastion -p 22 [email protected] ‘ncat -w 14400ms %h %p‘
/root/.ssh/目錄文件列表
-rw-------. 1 root root 3412 Mar 16 09:22 authorized_keys -rw-r--r-- 1 root root 216 Aug 24 09:37 config -rw-------. 1 root root 1675 Jan 8 2018 id_rsa -rw-r--r--. 1 root root 400 Jan 8 2018 id_rsa.pub -rw-------. 1 root root 1675 Jan 23 2018 keyfile_bastion -rw-------. 1 root root 1679 Jan 23 2018 keyfile_internal
/etc/hosts 內容
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.16 bastion.example.com
192.168.0.17 internal1.example.com
B 機器的 /etc/hosts 內容
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.0.16 bastion.example.com 192.168.0.17 internal1.example.com 192.168.0.18 internal2.example.com
ssh 跳板機 ProxyCommand