Test A SSH Connection from Windows commandline

Posted by IguanaMinstrel on Server Fault See other posts from Server Fault or by IguanaMinstrel
Published on 2013-06-28T15:49:43Z Indexed on 2013/06/28 16:24 UTC
Read the original article Hit count: 342

Filed under:
|
|
|
|

I am looking for a way to test if a SSH server is available from a Windows host. I found this one-liner, but it requires the a Unix/Linux host:

ssh -q -o "BatchMode=yes" user@host "echo 2>&1" && echo "UP" || echo "DOWN"

Telnet'ing to port 22 works, but that's not really scriptable. I have also played around with Plink, but I haven't found a way to get the functionality of the one-liner above.

Does anyone know Plink enough to make this work? Are there any other windows based tools that would work?

Please note that the SSH servers in question are behind a corporate firewall and are NOT internet accessible.


Arrrg. Figured it out:

C:\>plink -batch -v user@host
Looking up host "host"
Connecting to 10.10.10.10 port 22
We claim version: SSH-2.0-PuTTY_Release_0.62
Server version: SSH-2.0-OpenSSH_4.7p1-hpn12v17_q1.217
Using SSH protocol version 2
Server supports delayed compression; will try this later
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-256
Host key fingerprint is:
ssh-rsa 1024 aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Using username "user".
Using SSPI from SECUR32.DLL
Attempting GSSAPI authentication
GSSAPI authentication initialised
GSSAPI authentication initialised
GSSAPI authentication loop finished OK
Attempting keyboard-interactive authentication
Disconnected: Unable to authenticate

C:\>

© Server Fault or respective owner

Related posts about Windows

Related posts about ssh