我一直在使用Perl的SSH包连接到我的RHEL系统。最近,我将我的一个VM升级为redhat-release 7.2-9.el7.x86_64。现在,当我运行Perl脚本时,它抛出了错误:
无法在/usr/local/ line 64/Perl 5/Net/SSH/Perl/kex.pm第107行找到通过包"Net::SSH::Perl::Kex::C25519“的对象方法"exchange”。当生成ssh对象时。
在我的6.8RHEL版本上,同样的脚本也在运行。有什么建议吗?
以下是代码:
#!/usr/local/bin/perl
use strict;
use warnings;
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new($server_ip, debug=>1);
$ssh->login("root","password");调试打印:
[root@Automation_linux_10]# perl temp.pl
Automation_linux_[Auto_server_ip]: Reading configuration data /root/.ssh/config
Automation_linux_[Auto_server_ip]: Reading configuration data /etc/ssh_config
Automation_linux_[Auto_server_ip]: Allocated local port 1023.
Automation_linux_[Auto_server_ip]: Connecting to [SERVER_IP], port 22.
Automation_linux_[Auto_server_ip]: Remote version string: SSH-2.0-OpenSSH_6.6.1
Automation_linux_[Auto_server_ip]: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
Automation_linux_[Auto_server_ip]: Net::SSH::Perl Version 2.12, protocol version 2.0.
Automation_linux_[Auto_server_ip]: No compat match: OpenSSH_6.6.1.
Automation_linux_[Auto_server_ip]: Connection established.
Automation_linux_[Auto_server_ip]: Sent key-exchange init (KEXINIT), waiting for response.
Automation_linux_[Auto_server_ip]: Using curve25519-sha256@libssh.org for key exchange
Automation_linux_[Auto_server_ip]: Host key algorithm: ssh-ed25519
Automation_linux_[Auto_server_ip]: Algorithms, c->s: chacha20-poly1305@openssh.com <implicit> none
Automation_linux_[Auto_server_ip]: Algorithms, s->c: chacha20-poly1305@openssh.com <implicit> none
Can't locate object method "exchange" via package "Net::SSH::Perl::Kex::C25519" at /usr/local/lib64/perl5/Net/SSH/Perl/Kex.pm line 107.发布于 2017-08-23 11:19:06
我猜您没有安装Crypt::Curve25519 perl module。
为了发现这一点,我所做的是从Kex.pm中修改Net::SSH::Perl package,如下所示:
--- lib/perl5/vendor_perl/5.26.0/i386-netbsd-thread-multi/Net/SSH/Perl/Kex.pm.orig 2017-08-23 11:10:46.000000000 +0000
+++ lib/perl5/vendor_perl/5.26.0/i386-netbsd-thread-multi/Net/SSH/Perl/Kex.pm
@@ -234,6 +234,9 @@ sub choose_kex {
if (my $pkg = $kexmap{$name}) {
$kex->{ssh}->debug("Using $name for key exchange");
eval "use Net::SSH::Perl::Kex::$pkg";
+ if ($@) {
+ $kex->{ssh}->debug("Problem using Net::SSH::Perl::Kex::$pkg: $@");
+ }
$kex->{class_name} = __PACKAGE__ . '::' . $pkg;
} else {
croak "Bad kex algorithm $name";并使用上面的小测试脚本获得了上面提到的perl模块没有找到的大量错误消息。
https://stackoverflow.com/questions/45729175
复制相似问题