0

我对 unix/linux 相当陌生,并且在尝试通过 ssh 隧道连接到我大学的计算机时遇到问题。

我试图访问我学校网络上的计算机 A。但除非我已经进入学校网络,否则无法访问它。我可以 ssh 进入计算机 B,然后 ssh 进入计算机 A。假设计算机 C 只能通过计算机 B 访问,我将如何制作一个可以为我执行此操作的 shell 脚本?

到目前为止,我通过 B 隧道连接到计算机 A,但无法到达 C。我试过这个

    ssh -t user@computerB 'ssh user@computerA' 'ssh user@computerC'
    sh -t user@computerB "ssh user@computerA 'ssh user@computerC'"

我究竟做错了什么

4

1 回答 1

2

似乎为我工作。显然,您必须使用 -t 来强制为每次跳转分配 ptty:

jcomeau@intrepid:~/rentacoder/peppe/dentalcam$ ssh -t www "ssh -t tek 'ssh -t www'"
Linux unixshell.jcomeau.com 2.6.18.8 #1 SMP Mon Nov 22 15:26:09 EST 2010 i686 GNU/Linux

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No mail.
Last login: Thu Jul  7 02:03:30 2011 from c-76-103-110-80.hsd1.ca.comcast.net
jcomeau@unixshell:~$ logout
Connection to www closed.
Connection to tek closed.
Connection to www closed.
于 2011-07-07T06:04:12.467 回答