多段SSHをする方法。
単純にSSHを多重化すると、エラーになる。
#ssh hostA "ssh hostB"
Pseudo-terminal will not be allocated because stdin is not a terminal.
hostAにログインした場合に仮想端末を割り当てられるので、その仮想端末からhostBにコマンド入力していて、hostBが仮想端末を割り当てられないってことかな。たぶん。
で、これを実現するのが、SSHの"-t"オプション
-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful,
e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
強制的に仮想端末を割り当てる。
これを指定するだけでおk。
0 件のコメント:
コメントを投稿