Re: [問題] SSH Module
※ 引述《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
討論串 (同標題文章)