Linux problem: can't change port in sshd_config file

Most of us are not "computer people" so post your technical questions and comments here. If you have computer or Internet expertise, share it here.

Moderators: carlson1, Keith B

Post Reply
User avatar

Topic author
Charles L. Cotton
Site Admin
Posts in topic: 3
Posts: 17787
Joined: Wed Dec 22, 2004 9:31 pm
Location: Friendswood, TX
Contact:

Linux problem: can't change port in sshd_config file

#1

Post by Charles L. Cotton »

What I don't know about Linux would fill volumes!!! I have to use it for a ham radio repeater linking project.

The default ftp port is 22, but I changed it to XXXX for security reasons. I need to change it back to 22 for a short while, but when I change the port in the sshd_config file, I still have to use port XXXX to access. (That is, you can't ftp to port 22.) I've searched the rest of the file (sshd_config) and don't see the port number located anywhere else. The bottom line is the first port change from 22 to XXXX worked, but subsequent attempts to change it back to 22 have not worked even though the file shows the port to be 22.

Any ideas?

Thanks,
Chas.

parabelum
Senior Member
Posts in topic: 3
Posts: 2717
Joined: Mon Dec 21, 2015 12:22 pm

Re: Linux problem: can't change port in sshd_config file

#2

Post by parabelum »

So I guess you went to /etc/ssh/sshd_config file and searched for port 22 line, adjusted it to the new port and updated firewall accordingly? Reverse the steps (make sure your firewall update goes back to port 22)? Did you remove the # character?
User avatar

SQLGeek
Senior Member
Posts in topic: 2
Posts: 3269
Joined: Sun Feb 28, 2010 1:48 am
Location: Richmond, TX

Re: Linux problem: can't change port in sshd_config file

#3

Post by SQLGeek »

Sorry for the elementary question but did you restart the ssh service?

I'd be happy to look over the sshd_config file too if you want to pm it or email it to me.
Psalm 91:2

parabelum
Senior Member
Posts in topic: 3
Posts: 2717
Joined: Mon Dec 21, 2015 12:22 pm

Re: Linux problem: can't change port in sshd_config file

#4

Post by parabelum »

SQLGeek wrote: Fri Aug 28, 2020 11:36 pm Sorry for the elementary question but did you restart the ssh service?

I'd be happy to look over the sshd_config file too if you want to pm it or email it to me.
Good point.

/etc/init.d/apf restart and then /etc/init.d/sshd restart.
User avatar

Topic author
Charles L. Cotton
Site Admin
Posts in topic: 3
Posts: 17787
Joined: Wed Dec 22, 2004 9:31 pm
Location: Friendswood, TX
Contact:

Re: Linux problem: can't change port in sshd_config file

#5

Post by Charles L. Cotton »

SQLGeek wrote: Fri Aug 28, 2020 11:36 pm Sorry for the elementary question but did you restart the ssh service?

I'd be happy to look over the sshd_config file too if you want to pm it or email it to me.
That was it! I didn't reboot when I changed the port. As you can see, I'm green as grass when it comes to Linus.

Thanks,
Chas.
User avatar

Topic author
Charles L. Cotton
Site Admin
Posts in topic: 3
Posts: 17787
Joined: Wed Dec 22, 2004 9:31 pm
Location: Friendswood, TX
Contact:

Re: Linux problem: can't change port in sshd_config file

#6

Post by Charles L. Cotton »

parabelum wrote: Fri Aug 28, 2020 11:25 pm So I guess you went to /etc/ssh/sshd_config file and searched for port 22 line, adjusted it to the new port and updated firewall accordingly? Reverse the steps (make sure your firewall update goes back to port 22)? Did you remove the # character?
I used the "were is" command to find "22," changed it to a different port, then use the "write out" command. I did the same thing to change it back to port 22, but I didn't reboot the server and that was the problem.

Thanks,
Chas.

parabelum
Senior Member
Posts in topic: 3
Posts: 2717
Joined: Mon Dec 21, 2015 12:22 pm

Re: Linux problem: can't change port in sshd_config file

#7

Post by parabelum »

Very good, glad you got it fixed!
User avatar

SQLGeek
Senior Member
Posts in topic: 2
Posts: 3269
Joined: Sun Feb 28, 2010 1:48 am
Location: Richmond, TX

Re: Linux problem: can't change port in sshd_config file

#8

Post by SQLGeek »

Charles L. Cotton wrote: Sat Aug 29, 2020 1:14 pm
SQLGeek wrote: Fri Aug 28, 2020 11:36 pm Sorry for the elementary question but did you restart the ssh service?

I'd be happy to look over the sshd_config file too if you want to pm it or email it to me.
That was it! I didn't reboot when I changed the port. As you can see, I'm green as grass when it comes to Linus.

Thanks,
Chas.
Awesome! Glad you're in business. :cheers2:
Psalm 91:2
Post Reply

Return to “Technical Tips, Questions & Discussions (Computers & Internet)”