1

Net::OpenSSH を使用してリモート サーバーに接続しています。

my $ssh = Net::OpenSSH->new(
              $server, 
              user => $user_name, 
              passwd => $password, 
              strict_mode => 0, 
              master_opts => ['-v']
);

これは、認証が失敗した場合、または間違ったパスワードが指定された場合にハングします。

OpenSSH_6.0p1, OpenSSL 0.9.8d 28 Sep 2006
debug1: Reading configuration data /usr/software/etc/ssh_config
debug1: Connecting to 10.53.34.200 [10.53.34.200] port 22.
debug1: Connection established.
...
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password

上記の行にぶら下がっています。

「$Net::OpenSSH::debug=-1;」の設定 戻り値:

debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
# file object not yet found at /usr/hema/.libnet-openssh-perl/diag-10.53.34.200-21463-907722
# file object not yet found at /usr/hema/.libnet-openssh-perl/diag-10.53.34.200-21463-907722

そのような場合にそれを終了させるにはどうすればよいですか?

4

1 に答える 1

1

モジュールのドキュメントから、エラーを処理する方法は次のとおりです。

my $ssh = Net::OpenSSH->new($host);
$ssh->error and
die "Couldn't establish SSH connection: ". $ssh->error;
于 2013-09-04T09:27:21.397 に答える