#!/usr/bin/perl use warnings; use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new(); #using keys authorization my $pass = 'ztester'; $ssh2->connect('localhost') or die "Unable to connect Host $@ \n"; # works when run from z's homedir because you need # permission to read the keys $ssh2->auth_publickey('zentara', '/home/zentara/.ssh/id_dsa.pub', '/home/zentara/.ssh/id_dsa', $pass ); my $chan = $ssh2->channel(); $chan->blocking(1); #close up the filehandles... rename foo to whatever you want $chan->exec("nohup /home/zentara/perlplay/net/zzsleep > foo.out 2> foo.err < /dev/null &"); $chan->send_eof; exit;