rsync command pass password though script
7,099
You have tagged your question with perl
so...
Use Net::OpenSSH:
#!/usr/bin/perl
use strict;
use Net::OpenSSH;
my $ssh = Net::OpenSSH->new(user => $user, password => $password);
$ssh->rsync_get({verbose => 1}, $remote_directory, $local_directory)
or die $ssh->error;
Related videos on Youtube
Author by
Vivek Nigam
Updated on September 18, 2022Comments
-
Vivek Nigam over 1 year
I am using following command
rsync -avze ssh myUser@REMOTE_SERVER:/REMOTE_PATH/ LOCAL_PATH
It's asking for password. Is it possible to pass password through any script? I do not want to use
ssh
keys. -
roaima over 6 yearsPlease don't provide a link-only answer. It's better to summarise the relevant points here in case the other site goes away.