I am trying to avoid using Net::SSH::Perl library since there is some problems in installing the module using CPAN. Manual install seems too troublesome when I see that it depends on a long list of other Perl modules.
What I am trying to achieve is to log into the SSH with my username and password. Then I will need to run some commands in it and retrieve some files from the server using SSH.
I know how to pass the username, hostname and command using “ssh($username.”@”.$ip, $command) or die “SSH fails!”;”. However, I keep getting this error message:
ssh: connect to host XX.XX.XX.XXX port 22: Connection refused
where XX.XX.XX.XXX is the hostname or IP address of my computer and is in the subnet as the server that I am trying to get files from.
Does anyone knows how I can pass in the password to SSH or introduce me to good tutorials on Net::SSH? Most of the tutorials I found online are on Net::SSH::Perl and not for Net::SSH.
Did you see this FAQ section of the Net::SSH documentation?
The suggestion to try Net::SSH::Expect is a good one. It sounds, based on what you’ve said, that it fits your needs.
I have used Net::SSH::Expect quite a bit and I can attest to its simplicity if you’re just looking to get something done quickly