ssh -t wang@172.31.33.211 "ssh -t -g -R 33334:172.31.32.100:22322 xxxx@172.31.33.3 "ssh -p 33334 qch.wang@localhost" "
通过命令
ssh -t wang@172.31.33.211
登录到172.31.33.211
并且,登录后立即执行命令
ssh -t -g -R 33334:172.31.32.100:22322 xxxx@172.31.33.3
登录到172.31.33.3,把其所有访问其33334端口的请求,转发到172.31.32.100:22322
并且,登录后立即执行命令
ssh -p 33334 qingchuan.wang@localhost
登录到本机的33334端口
整条命令执行完,会登录到qingchuan.wang@172.31.32.100:22322
为了避免输入密码的麻烦,可以把:
本机的id_rsa.pub 添加到 wang@172.31.33.211:~/.ssh/authorized_keys
wang@172.31.33.211:~/.ssh/id_rsa.pub 添加到 xxxx@172.31.33.3:~/.ssh/authorized_keys
xxxx@172.31.33.3:~/.ssh/id_rsa.pub 添加到 xxxx@172.31.33.3:~/.ssh/authorized_keys
阅读(1889) | 评论(0) | 转发(0) |