my %SSH_Prm = ( "protocol" => '2', "use_pty" => 0, "options" => ["stricthostkeychecking no"], "identity_files" => ["/home/user/.ssh/id_rsa"], "debug" => 1, ); my $ssh = Net::SSH::Perl->new($server,%SSH_Prm); $ssh->login("deploy"); my ($out,$err,$exit) = $ssh->cmd("/usr/bin/sudo $command"); #### server.domain.net: Authentication methods that can continue: publickey. server.domain.net: Next method to try is publickey. server.domain.net: Trying pubkey authentication with key file '/home/user/.ssh/id_rsa' server.domain.net: Authentication methods that can continue: publickey. server.domain.net: Next method to try is publickey. Permission denied at ./start_tomcat_remote line 88 #### ssh -vv -i /home/user/.ssh/id_rsa deploy@server.domain.net ... debug1: Offering public key: /home/user/.ssh/id_rsa debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: pkalg ssh-rsa blen 277