7

In some tutorials around the web to install OpenSSH exists the following commands:

sudo apt install openssh-server
sudo apt install openssh-client

For example for Ubuntu Desktop is mandatory install the Openssh's Server - and it is not necessary for Ubuntu Server, it is already installed - furthermore I have never installed in some distribution the Openssh's Client, but I am able to connect to some host with ssh.

How to know the version of each one? In ssh(1) - Linux man page indicates:

-V' Display the version number and exit.

But is not clear if is for the server or client - in many tutorials has the same indication about to execute ssh -V, but they do not indicate explicitly if is for the server or client.

Reason:

I want to know the client version, because suddenly my laptop with MacOS can't do ssh for some hosts anymore (it after to did do an upgrade in the hosts Ubuntu from 20.04 to 22.04), while for another laptops with Linux (as client) they can do the ssh to the same hosts yet - after to did do a research, seems it is due the client version - therefore I want to know the client versions from MacOS and Linux.

6
  • I'm assuming that both will have always the same version. Try running: dpkg-query --showformat='${Version}\n' --show openssh-server openssh-client. In my case both return the same version. Oct 17, 2022 at 22:41
  • 2
    It's extremely uncommon to install the OpenSSH client tools and the sshd service from two different releases of OpenSSH.
    – Kusalananda
    Oct 17, 2022 at 22:50
  • dpkg - l | grep ssh. I wonder why you even need to know the exact versions. It's not as if SSH(d) has seen major new features recently. Oct 17, 2022 at 22:58
  • ssh -vv localhost will show both the client and server versions. Oct 17, 2022 at 23:29
  • Perhaps Should I assume when sudo apt install openssh-server was executed, internally was installed the client too? Even if I am wrong - I want to know what is the current OpenSSH Client available. Oct 18, 2022 at 0:18

1 Answer 1

10

for client:

$ ssh -V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020

for server:

$ sshd -V
unknown option -- V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020

or

nc -w1 localhost 22
SSH-2.0-OpenSSH_8.9p1 xxxx
4
  • 1
    I see, ssh is the client and sshd is the server Oct 18, 2022 at 0:41
  • 1
    Just being curious, why sshd -V returns unknown option -- v and later the expected information?. At a first glance seems illogical Oct 18, 2022 at 0:46
  • 1
    There's no -V but on unknown switch, the default behavior id to display the version number. Kind of little hack Oct 18, 2022 at 0:47
  • How to know this if it fails and won't even run due to a version mismatch? ldd?
    – mathtick
    Jul 26, 2023 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .