Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-06-2011, 09:18 PM
|
#1
|
LQ Newbie
Registered: Apr 2011
Posts: 2
Rep:
|
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.
|
|
|
04-06-2011, 11:22 PM
|
#2
|
Senior Member
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278
Rep:
|
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.
|
|
|
04-06-2011, 11:58 PM
|
#3
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep:
|
Can you post your sshd_config file so we can see the changes you made please?
|
|
|
04-07-2011, 02:31 AM
|
#4
|
LQ Newbie
Registered: Apr 2011
Posts: 2
Original Poster
Rep:
|
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?
|
|
|
04-07-2011, 05:53 AM
|
#5
|
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339
|
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: (f w/o -). Is there one or two sshd processes?
|
|
|
04-07-2011, 06:23 AM
|
#6
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
04-08-2011, 01:26 AM
|
#7
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,418
|
As per post #3, don't just tell us what you thought you did, always best to post the current sshd_config file content.
|
|
|
All times are GMT -5. The time now is 01:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|