Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this server that is configured to use another port instead of 22 for ssh. How may I figure out which port number it is?

share|improve this question
up vote 5 down vote accepted

Assuming you don't have access to command line (otherwise you would already know what the port number was), you can do a port scan to try and identify which port the SSH service is running on. I would suggest running nmap. There's no guarantee though that it will find it.

share|improve this answer
I try to scan using this command nmap -p 8000-8999 -r because I just remember it start with 8 for 4 digit. Is that enough to tell nmap I want to search for ssh? If the ssh is on 8111 did it will relize the opened port is ssh? I can't get it work because my IP already blocked by my server. I install something to prevent brute force. Now I am searching nmap command switch to scan slowly. – CallMeLaNN Apr 13 '11 at 1:56

If you have access to the commandline, and read access to /etc/ssh/sshd_config, run

grep Port /etc/ssh/sshd_config
share|improve this answer
Wow!! This is exactly what I was looking for.. :) – Saurav Kumar Feb 11 '14 at 12:19
Why isn't this the accepted answer? – Amalgovinus Jun 17 '14 at 20:44

Run nmap -sV <hostname/ip> - which is nmap with service detection, meaning it works out what's actually listening on the port, rather than guessing the service based on the port it's using.

This will give you output that looks something like:


666/tcp open ssh OpenSSH 5.3p1 Debian 3ubuntu4 (protocol 2.0)

If it still doesn't find the port, run nmap -p- -sV <hostname/IP> - this will scan all 65k ports - it's slower, but it will find it if it's running on a high up port.

share|improve this answer

You must log in to answer this question.

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