作者beakdoosan (东大)
看板Perl
标题Re: [问题] SSH Module
时间Sun Oct 5 17:43:19 2008
※ 引述《b60413 (None)》之铭言:
: 我写了一个连接SSH的Client程式如下
: $ssh = Net::SSH::Perl->new('xxx.xxx.xxx.xxx');
: $ssh->login('name', 'pass');
: $ssh->cmd('logout');
: 这个程式可以正常的登入SSH 但是速度却异常的慢
: 经过测试後发现是会卡在验证那一段($ssh->login('name', 'pass'))
: 请问这是正常的现象吗?
: 如果不是 应该要如何改才能够加快登入的速度?
: 谢谢
请问一下您是否曾遇到类似我这个问题
我的环境是winxp使用activePerl-5.8
我开启Net::SSH::Perl的debug讯息如下
======= Debug Message ========
888tiger-48e401: Next method to try is publickey.
888tiger-48e401: Next method to try is password.
888tiger-48e401: Trying password authentication.
888tiger-48e401: Login completed, opening dummy shell channel.
888tiger-48e401: Next method to try is publickey.
888tiger-48e401: Next method to try is password.
888tiger-48e401: Trying password authentication.
888tiger-48e401: Login completed, opening dummy shell channel.
888tiger-48e401: channel 0: new [client-session]
888tiger-48e401: Requesting channel_open for channel 0.
888tiger-48e401: channel 0: open confirm rwindow 0 rmax 32768
888tiger-48e401: Got channel open confirmation, requesting shell.
888tiger-48e401: Requesting service shell on channel 0.
888tiger-48e401: channel 1: new [client-session]
888tiger-48e401: Requesting channel_open for channel 1.
888tiger-48e401: Entering interactive session.
888tiger-48e401: Sending command: logout
888tiger-48e401: Requesting service exec on channel 1.
888tiger-48e401: channel 1: open confirm rwindow 0 rmax 32768
看起来登入有成功,到下command时就一直卡在最後一行那边,查了google
并没有看到一个成功的解法
我的code如下
===== code =====
use strict;
use Net::SSH::W32Perl;
my $SshHost = "192.168.1.201";
my $SshPort = "22";
my $SshDebug = 1;
my $SshUserName = "root";
my $SshPassWord = 'password';
my $cmd;
$ENV{HOME} = "c:/perl/mywork";
my $ssh = Net::SSH::W32Perl->new($SshHost,
(Protocol => 2,
port => "$SshPort",
debug => "$SshDebug",
interactive => 1)
);
$ssh->login("$SshUserName", "$SshPassWord", 0);
$cmd = "logout";
my ($out, $err, $exit) = $ssh->cmd($cmd);
有人遇过这样的问题吗??
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.31.177.174