Thread Net::SSH::Perl Login ohne Prompt (3 answers)
Opened by _B_ at 2005-11-20 03:02

_B_
 2005-11-20 03:02
#36934 #36934
User since
2005-11-20
3 Artikel
BenutzerIn
[default_avatar]
Hallo.

Dieser Code

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl

use warnings;
use strict;

use Net::SSH::Perl;

my $ssh = Net::SSH::Perl->new("A.B.C.D",
       port => "22",
       debug => "1",
       interactive => "0",
       options => [
               "BatchMode 1"
               ]
       );
$ssh->login('user','password');
my($out,$err,$exit) = $ssh->cmd("uname -a");
print "$out\n";


soll sich auf dem Host A.B.C.D mit dem Usernamen user anmelden. Leider ist es nichts mit dem promptlosen Login. Das Skript bricht beim Versuch der Publickey-Authentifizierung mit dem folgenden Fehler ab. (Zeile 16 ist die Zeile mit $ssh->login... . Der Fehler tritt beim Aufruf des Skripts als root und non-root auf.)

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
machine: Reading configuration data /home/admin/.ssh/config
machine: Reading configuration data /etc/ssh_config
machine: Connecting to A.B.C.D, port 22.
machine: Remote protocol version 2.0, remote software version OpenSSH_4.2p1 Debian-5
machine: Net::SSH::Perl Version 1.29, protocol version 2.0.
machine: No compat match: OpenSSH_4.2p1 Debian-5.
machine: Connection established.
machine: Sent key-exchange init (KEXINIT), wait response.
machine: Algorithms, c->s: 3des-cbc hmac-sha1 none
machine: Algorithms, s->c: 3des-cbc hmac-sha1 none
machine: Entering Diffie-Hellman Group 1 key exchange.
machine: Sent DH public key, waiting for reply.
machine: Received host key, type 'ssh-dss'.
machine: Host 'A.B.C.D' is known and matches the host key.
machine: Computing shared secret key.
machine: Verifying server signature.
machine: Waiting for NEWKEYS message.
machine: Enabling incoming encryption/MAC/compression.
machine: Send NEWKEYS, enable outgoing encryption/MAC/compression.
machine: Sending request for user-authentication service.
machine: Service accepted: ssh-userauth.
machine: Trying empty user-authentication request.
machine: Authentication methods that can continue: publickey,keyboard-interactive.
machine: Next method to try is publickey.
Permission denied at ./perlssh line 16


Es scheint, als müsse das Skript zunächst den Publickey Versuch machen, um als nächstes den Passwort-Login zu versuchen. Wie kann ich die Authentication-Method manuell setzen? Das Verhalten ist nachvollziehbar unter Linux wie MacOS X, hängt also nicht an der Plattform.

Danke für Ideen und Hilfe.

Sebastian

edit pq: code-tags hinzugefügt\n\n

<!--EDIT|_B_|1132483083-->

View full thread Net::SSH::Perl Login ohne Prompt