I'm trying to do something that should be simple but for some reason, I guess I'm just bored and making it difficult. I'm trying to run a command on a remote computer via SSH. The remote computer has the port changed for SSH and I need to use a key to connect. I first tried Net::SSH::Perl but I kept running into the "Received disconnect message: Too many authentication failures for abc at ~ ~ ~ AuthMgr.pm line 143. I see many people have had trouble with it so I moved on to something else like below. When I run this, I get "Undefined subroutine &main::ssh_cmd called at ./3test.pl line 3.". Net::SSH::Expect just seems to be overkill for something this simple. Can someone give me a hand on this?
use Net::SSH qw(ssh issh sshopen2 sshopen3);
user => 'root',
host => '192.168.1.2',
command => "chmod 777 /var/named/zzz.z",
args => ["-i /root/.ssh/thispc-ssh-key", "-P 33"],
stdin_string => "string\n",