tags:

views:

157

answers:

3

Could you please suggest a way to detect if the scp service is available on a server without the need for an account and/or password?

I am trying to figure out how to tell if

 Net::SCP->new( "hostname", "username" );

function fails to connect to remote because of service is unavailable at remote host or because of authentication failure.

+3  A: 

sshd would be running on port 22. Telnet to it to see if it is responding.

Chadwick
+1  A: 

Net::SCP doesn't use passwords unless you're using the interactive mode, it uses RSA or DSA keys. At the point you use get() or put(), those functions will return a true or false on success or failure.

You might wish to check out Net::SCP::Expect instead if you need to use passwords instead of key authentication. The perldoc for both modules has good examples to follow.

Zenham
A: 

use Net::SSH2 or Net::OpenSSH instead of Net::SCP

salva