Changing SSHD port not surviving reboot

Sam Varshavchik mrsam at courier-mta.com
Wed May 14 22:26:56 UTC 2025


Robert Moskowitz writes:

> I then reboot and sshd is back to port 22.
>
> I can then just restart ssh.socket and it switches to my desired port #
>
> What am I missing?

There should be some glue that reads ssh's configuration files and generates  
the fraking systemd configuration from it.

Try creating /etc/ssh/sshd_config.d/02-local.conf containing":

ListenAddress 192.168.0.1:1234

or whatever you want ssh to listen on. ssh's documentation says that  
ListenAddress overrides the default Port setting. Then:

systemctl daemon-reload
systemctl restart ssh.socket

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20250514/a6ed82df/attachment-0001.sig>


More information about the ubuntu-users mailing list