[英]Nested ssh tunnel command from within ssh not working
Assume machine A has an ssh tunnel to machine C via B , eg 假设机器A有一条通过B到机器C的ssh隧道,例如
ssh -N -L 12345:C:22 userB@B
which means that we are able to execute the ls command from A on C as follows: 这意味着我们能够从A在C上执行ls命令,如下所示:
ssh -p 12345 userC@localhost 'ls'
Up to now all this works and has been tested. 到现在为止,所有这些工作都已经通过并且已经过测试。
The problem is if there is another machine Z which has access to A , eg from Z we can run: 问题是,如果还有另一台机器Z可以访问A ,例如,我们可以从Z运行:
ssh userA@A 'ls'
and it works. 而且有效。 But this does not work:
但这不起作用:
ssh userA@A "ssh -p 12345 userC@localhost 'ls'"
The error message is Permission denied (publickey,password) 错误消息是“权限被拒绝”(公钥,密码)
Any ideas? 有任何想法吗? I do not use passwords but private/public keys for authentication.
我不使用密码,而是使用私钥/公钥进行身份验证。 The mystery is that if I do not nest the commands all works, ie I can executed a command on A from Z , I can execute a command on C from A , but I cannot execute the same command on C from Z .
神秘的是,如果我不嵌套所有工作的命令,即我可以从Z对A执行命令,就可以从A对C执行命令,但是我不能从Z对C执行同一命令。 Any help is appreciated.
任何帮助表示赞赏。
嵌套的隧道不是很漂亮。...考虑一个运行ssh的加固堡垒主机...连接到该主机,启用tmux和ssh到远程内部主机。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.