Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Mar 10 '10 at 23:19

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

    
This looks like a duplicate of: [ssh connection stop at “debug1: SSH2_MSG_KEXINIT sent” ](stackoverflow.com/questions/2419412/…) –  karafior Sep 27 '11 at 5:33

2 Answers 2

How are you sshing into the server? What command are you running / program are you using? Are you using Putty (Windows).

If you are using the ssh command line program, your ssh command should be

ssh -p 2222 www.mywebsite.com

unless you have edited ~/.ssh/config on the client.

share|improve this answer
    
i've used putty, secureCRT, ubuntu linux terminal from couple different PCs.. connection all got dropped –  Anonymous Mar 10 '10 at 17:27

show output from ssh -v -p2222 youdserver.com

share|improve this answer

Your Answer

 
discard

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