I need to run a series of commands on remote systems, but am having problems with perl staying logged in. I "can't" use the ssh or telnet command, as it is a service account logging in and has no password. I am trying this below, but the program ssh's into the system and doesn't exit until I ctl+d out.

system("ssh -qtt $server sudo cp /opt/uc4sand/bin/*.kstr /tmp/sand.kstr; sudo service uc4sand stop");
  • As far as I can see, the 2nd sudo would be executed locally, if its executed at all. Is that expected? – Kusalananda Feb 15 at 14:15

problem solved with:

my $ssh = Net::SSH::Perl->new(
                user    => 'user';
                ssh_arges => {
                        identity_files => [ '/home/account/.ssh/id_rsa ' ]
                        debug => 1,

        ) or die "could not open connection $server";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.