Bug 36766 added a (pretty awesome!) tool for sftping files to a remote server from the command line - it would be great if it also supported using keys for authentication to sftp servers. Our tool has something like the following, which works for us and probably would be good to add (or the like): if (defined $privatekey && $secret ) { # case for has a key with a password $sftp = Net::SFTP::Foreign->new("$remote", more => '-v', user => "$user", key_path => "$privatekey", passphrase => "$secret", port => $port, late_set_perm => 1 ); } elsif (defined $privatekey ) { # case for only a key $sftp = Net::SFTP::Foreign->new("$remote", user => "$user", key_path => "$privatekey", port => $port, late_set_perm => 1 ); } else { # case for only username/password $sftp = Net::SFTP::Foreign->new("$remote", user => "$user", password => "$secret", port => $port, late_set_perm => 1 ); }