How do I know if my server has SSH? Is there anyway to test?

  • Would this be better on SuperUser?
    – Jon Egerton
    Commented Jul 4, 2011 at 13:46

7 Answers 7


For ssh client : ssh google.com; if it says command not found, you havent got it installed.

For ssh server : ssh localhost; if it doesn't do anything you haven't got ssh server.

If you are running debian/ubuntu :

apt-get install openssh-server
  • 1
    Hmm, your ssh server check only works if ssh is running on its standard port Commented Jul 5, 2011 at 2:44
  • but if he had changed the port, then he would know he 's running ssh no :p? Commented Jul 6, 2011 at 5:22
  • That's assuming he's the one who set the server up. It could be one that he inherited. Commented Jul 6, 2011 at 9:00
  • Fair enough then Commented Jul 8, 2011 at 22:01
  • How do I know that in Windows Server? Commented Oct 16, 2020 at 6:47

Absence of a public key is by no means the only way the ssh command can fail, so this is an approximation at best; it could be sufficient, though.

ssh $host "echo 2>&1" && echo $host OK || echo $host NOK

Oh, and being a bit more specific would be great.


which ssh would tell you if you have the SSH client installed. But you might be asking whether your server allows you to connect to it using ssh, at which point you are looking for SSH -the SSH daemon- and not SSH itself. If you have it installed should be able to start it with /etc/init.d/sshd start as root. If you cannot find a similarily named script odds are it's not installed. Most distros should have it installed by default.


Another note:

telnet <target> 22

The first line should be plaintext telling you about the SSH version.

Also nmap can do SERVICE/VERSION DETECTION (-sV: Probe open ports to determine service/version info). That could help you find a misconfigured port (typos hide everywhere, I had ssh runnning on 21 and closed all connections to the server).

  • +1 for nmap, it's probably the simplest way to know for sure, but it can of course be blocked by a firewall Commented Jul 5, 2011 at 2:46

Quite an old one but I've just hit this post for the same reason and following on from ArtB's post of which ssh (outputs /usr/sbin/ssh for my default Ubuntu install) you can also do which sshd which outputs /usr/sbin/sshd

Though to be honest the best way to see if anything is running on Linux is ps aux is it not? So in this instance ps aux | grep sshd, or for those wanting perfection and hiding the grep command ps aux | grep -v grep | grep sshd, out as follows on my Ubuntu that I've just installed OpenSSH-Server on:

ps aux | grep -v grep | grep sshd root 5638 0.0 0.1 61372 5532 ? Ss 15:35 0:00 /usr/sbin/sshd -D


If it is a debian derivative (ubuntu, debian, mint) then:

dpkg -l | grep "openssh-server"

Should show you something like:

ii  openssh-server                               1:7.6p1-4ubuntu0.3                               amd64        secure shell (SSH) server, for secure access from remote machines

With the ii saying it is installed. If it shows nothing, then it isn't.

If you want to know if you have the ssh client, then use dpkg -l | grep "openssh-client" instead.


One way is to check if you have ssh RPM Package installed

[sanyadav@localhost ~]$ **rpm -qa | grep -i ssh**

Output =>


Further if you want to see version of ssh rpm package installed

[sanyadav@localhost ~]$rpm -qi openssh-clients-6.6.1p1-11.el7.x86_64

Output =>

Name        : openssh-clients
Version     : 6.6.1p1
Release     : 11.el7
Architecture: x86_64

You must log in to answer this question.