Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

Thanks for any ideas!

share|improve this question

3 Answers 3

up vote 2 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
1  
I try to scan using this command nmap -p 8000-8999 -r domain.com 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 at 12:19
    
Why isn't this the accepted answer? –  Amalgovinus Jun 17 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:

PORT STATE SERVICE VERSION

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

Your Answer

 
discard

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

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