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;
Share:
7,099

Related videos on Youtube

Vivek Nigam
Author by

Vivek Nigam

Updated on September 18, 2022

Comments

  • Vivek Nigam
    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
    roaima over 6 years
    Please don't provide a link-only answer. It's better to summarise the relevant points here in case the other site goes away.