1. #!/usr/bin/perl


  2. use 5.012;
  3. use strict;
  4. use warnings;
  5. use autodie;
  6. use Net::OpenSSH;


  7. my %param = (
  8. user => 'fivetrees',
  9. passphrase => '123456',
  10. key_path => '/home/fivetrees/.ssh/fivetrees',
  11. timeout => 10
  12. );


  13. my $ssh = Net::OpenSSH->new('192.168.1.2', %param);
  14. $ssh->system('echo "hello" >> xxxxx.txt');
  15. $ssh->scp_put('/root/a.txt', '/root/');


09-21 03:20