I was doing fine with default ssh port 22 on my remote server then i read somewhere if i change the port to 2222 at least i can stop some automated login attempt to my ssh server so i've decided to change the port on my server
What I've Changed
System: Ubuntu 8.04 32bits with sudo apt-get install ssh
vi /etc/ssh/sshd_config
change port 22 to port 2222
/etc/init.d/sshd restart
After i changed and restarted sshd It can't seem to work, now Im locked out of it but im sure port is open;
to test it i use telnet to port 2222
telnet wwww.example.com 2222 i get reply
SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2
nmap port scan it nmap -p 2222 www.mywebsite.com
Starting Nmap 4.53 ( http://insecure.org ) Interesting ports on www.mywebsite.com (x.x.x.x): PORT STATE SERVICE
2222/tcp open unknown
router: linksys 54GL router firmware: Firmware: DD-WRT v24-sp1 vpn
i used port forwarding to map router port 2222 to my pc's port 2222
only 1 user..
thanks to shuvalo
ssh -v -p 2222 www.example.com
joec@server:~$ ssh -v -p2222 www.example.com
OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to www.example.com[100.100.100.100] port 2222.
debug1: Connection established.
debug1: identity file /home/joec/.ssh/identity type -1
debug1: identity file /home/joec/.ssh/id_rsa type -1
debug1: identity file /home/joec/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu1.2
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu1.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 100.100.100.100
I hope these helps