#!/usr/bin/perl -w #### Bibliothèques use strict; use warnings; use Net::SSH2; #### Variables my $ip='X.X.X.X'; my $user='user'; my $password='passwd'; #print "IMEI: "; #my $imei = <>; #chomp($imei); #my $cmd = "/opt/LSS/bin/ueadmin_cli -o delete -I $imei"; my $cmd = "ls"; # this command for testing purpose only #### Open SSH connexion and sending command my $ssh = Net::SSH2->new(); $ssh->connect("$ip") or die "SSH connexion Failed.\n"; if ($ssh->auth_password("$user","$password")) { my $chan = $ssh->channel(); $chan->exec($cmd); print while <$chan>; $chan->close(); }else {print "authentication failed.\n";} $ssh->disconnect;