-1

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:\>
IguanaMinstrel
  • 11
  • 1
  • 1
  • 3
  • If ssh is up on a windows host the output should be about the same. What makes you think that Windows would handle the protocol differently? – mdpc Jun 28 '13 at 16:15

1 Answers1

1

Putty has a command line mode. Probably would work, but I'm not positive.

You could also use Nmap to check if the port is accepting connections.

John Homer
  • 1,293
  • 10
  • 10