$ssh2= Net::SSH2->new(); my $host = 'serveraddress'; my $port = 22; my $user = 'username'; $ssh2->connect($host, $port) or $ssh2->die_with_error; my $ppk_filepath = 'C:\Users\username\rsa-key-username'; print "$ppk_filepath exists!\n" if -e $ppk_filepath; $ssh2->auth_publickey($user, undef, $ppk_filepath, 'passphrase123' ) or $ssh2->die_with_error;