I connect to a linux machine (centos 6.4) ussing putty. Except from fact that I can set putty to only use one type of protocol, how can I find the current's ssh connection version (SSH1 or SSH2)?

  • It can help to show what research you've already done – Drew Khoury Oct 12 '13 at 8:34
  • @DrewKhoury I only tried with google to find an answer to this but no result found regardin this. No one explains how can I see the current connection (in use) protocol (ssh1 or ssh2). – codiac Oct 12 '13 at 10:20

Once you are in you say:

ssh -v localhost

it will tell you the exact version of the server.

  • 3
    It doesn't seem that this shows the current connection type. – codiac Oct 12 '13 at 8:30

Putty In Session, Logging, select the "SSH packets and raw data" radio button. Select the log file as putty.log in a location of your choice. Make the connection. You should see:

Event Log: Server version: SSH-2.0-OpenSSH_5.3
Event Log: Using SSH protocol version 2

See below for details on what SSH-2.0 means.

Other Methods You could also try using the telnet client but point to port 22:

telnet test1 22

When you connect you will see:

Trying 192.168.144.145... Connected to test1. Escape character is '^]'. SSH-2.0-OpenSSH_5.3

The last line is the one to look for:

SSH-2.0-OpenSSH_5.3

If it says SSH-2.0 then that is good, the ssh server you connected to supports only SSH Protocol Version 2. It will not support connections from SSH V1 Protocol Clients.

If however you see:

SSH-1.99-OpenSSH_5.3

Then that means that the server end is still supporting SSL Protocol Version 1. It has something like this in it's sshd_config file:

Protocol 1,2

Protocol 1 is vulnerable and should not be used.

So to get that straight. If you see SSH-2 when you telnet to port 22 of the remote server then you can only be using ssh Protocol Version 2 as the server does not support Protocol 1.

As per cstamas answer above, the -v flag will show a line:

debug1: Remote protocol version 1.99, remote software version OpenSSH_5.3

or:

debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3

You want to see version 2.0 there.

I know this is an old question but since I came across I could resist on posting an alternative way.

As cstamas suggested you can use ssh -v localhost you simply ssh to your self 127.0.0.1 on verbose mode, which will display debugging message of the progress. Yes through this process you can look at the top of the communication and you can get the SSH version that you are currently running.

But If you read the ssh man page you will find the -V option on ssh more useful. Taken out the ssh man page:

-V' Display the version number and exit.

-v' Verbose mode. Causes ssh to print debugging messages about its progress. This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increase the verbosity. The maximum is 3.

So I think it would be better to simply do ssh -V and get something similar to:

ssh -V
OpenSSH_6.6.1p1, OpenSSL 1.0.1e-fips 11 Feb 2013

Hope this helps.

  • 1
    That's the version of the program, not the protocol used for a connection. As a 3-year earlier answer correctly explained, the very same program can support both SSH1 and SSH2 protcols, or not, depending on configuration. – dave_thompson_085 Mar 1 at 9:35

You can get this pretty quickly using netcat from your local machine, for example:

$ nc [IP_ADDRESS] 22
SSH-2.0-OpenSSH_5.3

I like this better:

$ echo ~ | nc localhost 22
SSH-1.99-OpenSSH_3.9p1
Protocol mismatch.
$

The benefit here is that it can be done programatically since the connection isn't held open. For Python, try:

ssh_protocol = float(re.search("SSH-(\d.\d+)").group(0))

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.