#!/usr/bin/perl use strict; use warnings; use 5.010; my $HOME = $ENV{HOME}; use Net::SSH2; my $SSH2 = Net::SSH2->new(); my $Server_Adresse = "mein-soervaer.deh"; my $Nutzer = "root"; my $PW = "test4711"; my $SSH2_Authentifizierung; if ( $SSH2->connect($Server_Adresse) ) { $SSH2_Authentifizierung = $SSH2->auth_publickey( $Nutzer, "$HOME/.ssh/id_rsa.pub", "$HOME/.ssh/id_rsa", $PW ); } if ( $SSH2_Authentifizierung && $SSH2->auth_ok ) { print "Success"; } else { print join ", ", $SSH2->error; }