## scp.pl ## use strict; use warnings; use Net::SSH2; die "Usage: perl scp.pl username password" unless @ARGV == 2; my $host = '192.168.0.101'; my $user = $ARGV[0]; my $password = $ARGV[1]; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); print "\nconnecting to $host...\n"; $ssh2->connect($host) or die $ssh2->error; print "\nauth to $host...\n"; $ssh2->auth_password($user,$password) or die $ssh2->error; printf "Auth OK: %s\n", $ssh2->auth_ok; print "scp put\n"; my $ret = $ssh2->scp_put("rub'bish.txt", "/home/sisyphus/Downloads/rub'bish.txt"); print "ret: $ret\n"; $ssh2->disconnect();