Solved - Re: Changing SSHD port not surviving reboot
Robert Moskowitz
rgm at htt-consult.com
Wed May 14 22:56:33 UTC 2025
On 5/14/25 6:26 PM, Sam Varshavchik wrote:
> 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
root at host:/etc/ssh/sshd_config.d# systemctl daemon-reload
root at host:/etc/ssh/sshd_config.d# systemctl restart ssh.socket
Warning: The unit file, source configuration file or drop-ins of
ssh.socket changed on disk. Run 'systemctl daemon-reload' to reload units.
Got to love these warnings...
reboot
And SSHD is listening on my port of choice.
thanks
More information about the ubuntu-users
mailing list