Scp with pending module not working
I wrote the following program to automate the scp command in perl.
#!/usr/bin/expect
spawn scp hscpe@9.126.134.54:/home/hscpe/output.txt imt
set pass "jujsa32s"
expect {
password: {send "$pass\r"; exp_continue
}
But no file transfer happens. Usually on the console if I tried the same scp command it works fine. Can anyone figure out the problem
Thanks in advance!..
+3
source to share
3 answers
use Net :: OpenSSH :
my $ssh = Net::OpenSSH->new('hscpe@9.126.134.54', password => 'jujsa32s');
$ssh->scp_get('/home/hscpe/output.txt', 'imt/output.txt');
+2
source to share