replacing telnet with ssh

為{幸葍}努か 提交于 2021-02-07 20:34:16

问题


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, but cmd("su - user -c 'commands'") does


来源:https://stackoverflow.com/questions/8805369/replacing-telnet-with-ssh

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!