问题
I have some programs that use the Net::Telnet module to connect to several servers. Now the administrators have decided to replace the Telnet service for SSH, keeping everything else like before (for example the user accounts)
I've taken a look at Net::SSH2 and I see that I would have to change most part of the programs. Do you know of other SSH modules, better suited for this same replacement?
The client is a Windows box (ActiveState Perl or Cygwin Perl)
回答1:
Net::OpenSSH!
And check the chapter about how to integrate it with Net::Telnet.
回答2:
Thanks for your suggestions, but I finally used Net::SSH::Perl on ActivePerl for Windows
Pros:
- quite similar to Net::Telnet. There is no close method, but instead of
$host->close
you can do$host->cmd("exit")
- native Perl implementation
Cons:
- each
cmd()
call has a different state, for example it doesn't keep the current directory between calls, like Net::Telnet did - needs a modification in the module code to work on Windows, see: https://rt.cpan.org/Public/Bug/Display.html?id=18154
cmd("su - user")
doesn't work, butcmd("su - user -c 'commands'")
does
来源:https://stackoverflow.com/questions/8805369/replacing-telnet-with-ssh