Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

migrated from Jul 4 '11 at 14:55

This question came from our site for professional and enthusiast programmers.

Would this be better on SuperUser? –  Jon Egerton Jul 4 '11 at 13:46

4 Answers 4

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.

share|improve this answer

For ssh client : ssh; 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
share|improve this answer
Kauffman Thanks –  Ginger Bill Jul 4 '11 at 13:44
Hmm, your ssh server check only works if ssh is running on its standard port –  Mark Henderson Jul 5 '11 at 2:44
but if he had changed the port, then he would know he 's running ssh no :p? –  Lucas Kauffman Jul 6 '11 at 5:22
That's assuming he's the one who set the server up. It could be one that he inherited. –  Mark Henderson Jul 6 '11 at 9:00
Fair enough then –  Lucas Kauffman Jul 8 '11 at 22:01

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.

share|improve this answer

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).

share|improve this answer
+1 for nmap, it's probably the simplest way to know for sure, but it can of course be blocked by a firewall –  Mark Henderson Jul 5 '11 at 2:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.