Can't find remote host with ssh connect attempt to remote server

Joined
May 27, 2021
Messages
1
Reaction score
0
Edit

Using Linux and remote ssh command (I've placed my public ssh key on the remote server to allow non-password prompted connects)
The following command runs fine from the Linux command line:

ssh root@remoteIP /usr/bin/ls

However, when the following is called from my perl script:

system("ssh root@remoteIP /usr/bin/ls");

Perl reports:

ssh: Could not resolve hostname root.remoteIP: Name or service not known

(remoteIP is the real IP address of the remote computer. Obviously, I need to tell Perl how to resolve the address?)
 
Joined
Sep 3, 2023
Messages
36
Reaction score
2
Dont think you meant interpolate the var @remoteIP. Its always helpful print out the command you mean to execute.
Perl:
my $cmd = 'ssh ...';
print "'$cmd'\n";
system($cmd);
 
Joined
Nov 23, 2023
Messages
59
Reaction score
3
Edit

Using Linux and remote ssh command (I've placed my public ssh key on the remote server to allow non-password prompted connects)
The following command runs fine from the Linux command line:

ssh root@remoteIP /usr/bin/ls

However, when the following is called from my perl script:

system("ssh root@remoteIP /usr/bin/ls");

Perl reports:

ssh: Could not resolve hostname root.remoteIP: Name or service not known

(remoteIP is the real IP address of the remote computer. Obviously, I need to tell Perl how to resolve the address?)
Double-check the server address or hostname you're using. Ensure it's accurate and matches the server you're trying to connect to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,931
Messages
2,570,085
Members
46,536
Latest member
keelop

Latest Threads

Top