2

thanks in advance for reading/responding.

I've taken to the internet and found several well written articles on HOW to change the standard SSH port from 22 to XXXXX. However after reading these linked articles below, I'm still unable to change the SSH port to anything besides the standard 22. Please provide guidance, and if I've missed an article/post that does provide guidance, please link it back.

I first started here

How do you change the SSH port number?

here

https://raspberrytips.com/security-tips-raspberry-pi/#8_%E2%80%93_SSH_Change_the_default_port

and also here.

http://kamilslab.com/2016/12/10/how-to-change-your-ssh-port-on-the-raspberry-pi/

All of these links are fairly straight forward; however after attempting to change the port number from 22 to say a number like 5884; after saving the file, restarting the service, then running sudo service ssh status; my status states I'm running on port 22. I've confirmed its port 22 because I'm using Putty on port 22 after login and password are used.

Apr 26 20:50:15 raspberrypi systemd[1]: Starting OpenBSD Secure Shell server...
Apr 26 20:50:15 raspberrypi sshd[8110]: Server listening on 0.0.0.0 port 22.
Apr 26 20:50:15 raspberrypi sshd[8110]: Server listening on :: port 22.
Apr 26 20:50:15 raspberrypi systemd[1]: Started OpenBSD Secure Shell server.

Of note, if it's not obvious, I'm certainly considered rather new in my Raspberry Pi. However I do have a Pi 3B+ acting as a Pi-Hole right now. The one in question is a new Pi 4b that I'm trying to "harden" prior to putting on the network as a new Pi-Hole + VPN + etc...

Any help would be appreciated. Many thanks in advance.

1
  • Please edit your questtion and add the output of these commands to it: systemctl cat ssh.service and cat /etc/default/ssh.
    – Ingo
    May 28, 2020 at 17:08

1 Answer 1

2

Did you uncomment and capitalize the line that originally says Port 22?

I followed the first guide that you linked to and mine is uncommented, and kept the word 'Port' capitalized.

On a fresh install the sshd_config line refering to the port # looks like this:

#Port 22

And after changing it, (if you wanted your new ssh port to be 3333, would look like this:

Port 3333

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.