#!/usr/bin/suidperl # running setgid to get access to identity file use strict; use warnings; my %c; $ENV{PATH} = ''; $c{user} = 'www'; $c{remote} = '192.168.1.3'; $c{identity} = "/etc/pass/id_rsa"; # readable root.special_group use Net::SCP::Expect; my $scpe = Net::SCP::Expect->new(host=>$c{remote}, user=>$c{user}, identity_file=>$c{identity} ); $scpe->scp("/home/eks/profiles.ini", "/home/www/");