Thread SSH: SSH Agent Forwarding + Authentication (6 answers)
Opened by Taulmarill at 2004-04-13 15:44

Snox
 2004-04-13 14:48
#38159 #38159
User since
2004-04-13
4 Artikel
BenutzerIn
[default_avatar]
Hallo,

für SSH Verbindungen mit Perl benutzte ich Net:SSH::Perl.
Die Anmeldung an dem Host erfolgt immer per Key und ohne Passwort, da hier der Agent mit eingebunden ist.

Eine einfache Verbindung, Host A zu Host B ist auch ohne Probleme möglich. Leider muss ich von Host A über Host B zu Host C gelangen, um dort weitere Skripte ausführen zu können. Versuche ich eine weitere SSH-Verbindung von Host B zu Host C aufzumachen ( my $cmd = "ssh appsvc1 hostname"; ) bekomme ich immer einen premission denied.

Ich denke da funktioniert was nicht mit dem Agent Forwarding.
Über das Terminal geht das alles Einwandfrei.
- Kann mir jemand vielleicht helfen?
- Wie kann man mit Net::SSH::Perl das Agent Forwarding benutzten?

---
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
26
27
28
29
30
#!/usr/bin/perl -w

use strict;
use Net::SSH::Perl;
use Net::SSH::Perl::Agent;
use Net::SSH::Perl::Key;

my $agent = Net::SSH::Perl::Agent->new(1);
my $iter = $agent->identity_iterator;
while (my($key, $comment) = $iter->()) {
       ## Do something with $key.
print ("Key: " , $key , ":" , $comment ,"\n");
print ("test\n");
print ("-----------------------------------------\n\n");
my $host = "iksa-hop1";
my $user = "daitdsi";
my $ssh = Net::SSH::Perl->new($host);
$ssh->login($user);
my $cmd = "ssh appsvc1 hostname";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print ("-----------------------------------------\n\n");
print ("out: $stdout\n");
print ("-----------------------------------------\n\n");
print ("err: $stderr\n");
print ("-----------------------------------------\n\n");
print ("exi: $exit\n");
print ("-----------------------------------------\n\n");
}

exit(0);

---

MFG Snox\n\n

<!--EDIT|renee|1081859983-->

View full thread SSH: SSH Agent Forwarding + Authentication