0

I'm trying to automate a process with perl that will basically telnet into one system, "ssh -f -N" into two more and finally open a screen/tmux session and run sshuttle, then disconnect from screen/tmux.

If I am going to be running ssh with the "-f -N" options - is this best handled through Net::SSH::Expect, Net::Expect, system or exec?

I'm concerned with Net::SSH or Net::Expect as I'm not sure of a few things, first, how can I get Net::Expect/SSH to recognize that the SSH session is successful? That is to say, when I program Net::Expect and spawn the ssh session with those parameters, and subsequently login, there is no more output for 'expect' to see. I'd like to rely upon something other than the expect timeout.

Does that make sense? I'm not sure I'm phrasing my question clearly.

I'm also not sure how perl will behave if I spawn the ssh session that goes into the background. Will my perl program never exit? Waiting for the backgrounded SSH sessions to end?

It is because of this last question that I ask the additional questions of whether I should be considering the use of system or exec calls over Net::Expect.

4

1 回答 1

0

您可以使用Net::OpenSSH,如果需要,它可以与 Expect 集成。

编辑,呃,我错过了你通过 telnet 会话中继它。忽略以上。

于 2012-08-27T23:57:03.627 回答