Changing SSHD port not surviving reboot

Robert Moskowitz rgm at htt-consult.com
Wed May 14 20:42:02 UTC 2025


I followed the advice at:

https://askubuntu.com/questions/1439461/ssh-default-port-not-changing-ubuntu-22-10-and-later

and

 1. |mkdir -p /etc/systemd/system/ssh.socket.d|
 2.

    |cat >/etc/systemd/system/ssh.socket.d/listen.conf <<EOF [Socket]
    ListenStream= ListenStream=1234 EOF |

 3. |sudo systemctl daemon-reload|
 4. |sudo systemctl restart ssh.socket|

and

netstat -tulpn

shows the change.

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?

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20250514/74c9f3b2/attachment.html>


More information about the ubuntu-users mailing list