SSH Port 202 not working after changing /etc/ssh/sshd_config
-
Hi everyone,
Yesterday, I reinstalled and restored my server, and everything went smoothly without any issues. After the installation, I tried to change the SSH port to 202 in the
/etc/ssh/sshd_config
file. I added the following line:Port 202 # Do not use any other port. Only this port is not blocked by the Cloudron firewall
Then, I restarted SSH using:
systemctl restart ssh
(I noticed that older documents suggest
systemctl restart sshd
, but that doesn't seem to work anymore). However, I still can't connect via port 202. I have to use the default connection command:ssh user@ip_server
I'm running Ubuntu 24.04.01 LTS. Is this method still valid for Cloudron, or did I miss something?
Thanks for your help!
-
After changing the port, then you have to connect this way:
ssh user@ip_server -p 202
-
@matix131997 I tried connecting with the following command:
ssh -p 202 root@ip
But it fails with the error:
Connection refused
It seems like port 22 is still open, and port 202 doesn't work. I was expecting that after the restart, port 22 would be closed and I would only be able to connect through port 202.
-
This should be in the Cloudron docs…
-
So, I didn't have to change
/lib/systemd/system/ssh.socket
at all. But I did have to reboot the server since a simplesystemctl restart ssh
did not work. Curiously, after reboot the socket file still has ListenStream as 22 but I can connect only to 202. -
-
-
I was about to write a long time ago that the parameter for resetting SSH has changed:
sudo systemctl restart ssh.socket