LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-06-2011, 09:18 PM   #1
boyla
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
SSH is still listening on port 22 after change to a new port?


Hello,

I edited "sshd_config" file and changed port 22 to a new port. After I restart ssh, it listens on port 22 and the new port.
How can I disable SSH to listen on port 22? I'm using Debian.
 
Old 04-06-2011, 11:22 PM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
What port number you used to change? before change the port just confirm whether the port assigned to any other service on /etc/services. I think you have to use the port number above 1024.
 
Old 04-06-2011, 11:58 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Can you post your sshd_config file so we can see the changes you made please?
 
Old 04-07-2011, 02:31 AM   #4
boyla
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Original Poster
Rep: Reputation: 0
I changed to port 2567.
What I did is:

nano /etc/ssh/sshd_config

change Port 22 to 2567 -> save sshd_config

/etc/init.d/ssh restart

After that I try to access the server via port 22 and 2567. Both ports work! I don't know why sshd is still listening on port 22?
 
Old 04-07-2011, 05:53 AM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Often I find it more reliable to stop and start a service instead of using reload or restart. What daemons do you see running with:
Code:
ps -e f
(f w/o -). Is there one or two sshd processes?
 
Old 04-07-2011, 06:23 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Did you remove the # at the beginning of the line? If not, the default will be still used.

Did you have an active session when you restarted the ssh service? Port 22 may be open from a connection made before the the change.

Do you have more than one "Port ..." lines in the configuration. I don't know what would happen if you did.

Is sshd an xinetd service?

Is there a router you are going though that is changing port numbers?

Last edited by jschiwal; 04-07-2011 at 06:26 AM.
 
Old 04-08-2011, 01:26 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,418

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
As per post #3, don't just tell us what you thought you did, always best to post the current sshd_config file content.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SFTP server port blocked on Uni network, need to change the listening port. sammyboy161 Linux - Newbie 2 10-21-2010 01:03 PM
[SOLVED] ssh listening to a non-standard port? twaddlac Linux - Networking 3 10-04-2010 04:15 PM
Howto do Secured ssh from port https or port80(standard) to ssh d listening port 22 ? Xeratul Linux - General 4 11-23-2006 07:09 AM
ssh listening on port 22 sharpie Linux - Security 9 06-08-2004 04:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration