sudo apt-get install libssh2-1-dev sudo apt-get install zlib1g sudo apt-get install zlib1g-dev #### #!/usr/bin/perl -w use strict; use 5.010; use lib "template_stuff"; use File::Basename; use Net::SSH2; use File::Spec; use Term::ReadKey; my $rftp = get_ftp_object(); say "object created, back in main"; #### sub get_ftp_object{ use strict; use Net::SSH2; use 5.01; my $sub_hash = "my_sftp"; my $domain = $config{$sub_hash}->{'domain'}; my $username = $config{$sub_hash}->{'username'}; my $password = $config{$sub_hash}->{'password'}; say "values are $domain $username $password"; #dial up the server my $ssh2 = Net::SSH2->new(); $ssh2->connect($domain) or die "Unable to connect Host $@ \n"; say "connect worked"; #this works for passwords $ssh2->auth_password($username,$password) or die "Unable to login $@ \n"; return $ssh2; }