Leser: 2
7 Einträge, 1 Seite |
ssh -i ~/.ssh/identity remoteuser@remotehost "commando"
ssh -i ~/.ssh/identity remoteuser@remotehost "commando"
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);
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
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 = "hostname";
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print ("Erster Host: $stdout\n");
$cmd = ". /home/daitdsi/.bashrc; ssh -i /home/daitdsi/.ssh/authorized_keys daitdsi\@appsvc1 hostname";
($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print ("-----------------------------------------\n\n");
print ("Zweiter Host: $stdout\n");
print ("-----------------------------------------\n\n");
print ("err:\n$stderr\n");
print ("-----------------------------------------\n\n");
print ("exi:\n$exit\n");
}
exit(0);
7 Einträge, 1 Seite |