use warnings; use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('192.168.0.3') or die "Unable to connect Host $@ \n"; $ssh2->auth_password('user','password') or die "Unable to login $@ \n"; my $chan2 = $ssh2->channel(); $chan2->blocking(1); $chan2->exec('pwd'); $chan2->read(my $buf, 100); print $buf; $chan2->close;