Page 1 of 1

Linux problem: can't change port in sshd_config file

Posted: Fri Aug 28, 2020 10:56 pm
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.

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

Posted: Fri Aug 28, 2020 11:25 pm
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?

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

Posted: Fri Aug 28, 2020 11:36 pm
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.

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

Posted: Fri Aug 28, 2020 11:41 pm
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.

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

Posted: Sat Aug 29, 2020 1:14 pm
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.

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

Posted: Sat Aug 29, 2020 1:15 pm
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.

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

Posted: Sat Aug 29, 2020 3:48 pm
by parabelum
Very good, glad you got it fixed!

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

Posted: Sat Aug 29, 2020 9:10 pm
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: