How can I run command via SSH on remote device?
I'm trying next ideas:
1:
[root@0400smarts-voip01 test]# ssh user@IP "my command"
user@IP's password:
Connection to IP closed by remote host.
2:
[root@0400smarts-voip01 test]# ssh -t user@IP "my command"
user@IP's password:
Connection to IP closed by remote host.
Connection to IP closed.
Also i'm trying run command via Perl script:
#!/bin/perl
use strict;
use Net::OpenSSH;
my $hostname = "IP";
my $username = "user";
my $password = "password";
my $cmd = "command";
my $ssh = Net::OpenSSH->new(host=>"$hostname", user=>"$username", port=>22, password=>"$password");
$ssh->system($cmd);
But this method also doesn't work:
[root@0400smarts-voip01 test]# ./test.pl
Connection to IP closed by remote host.
How can I solve this problem?