Ubuntu ssh server

Apparently, ubuntu is using systemd-sockets for quite some time, so the way to change the default ssh port has changed.

Here’s how do it:

  • touch /etc/systemd/system/ssh.socket.d/listen.conf
  • Put the following in it:
    cat <<EOF > /etc/systemd/system/ssh.socket.d/listen.conf
    [Socket]
    ListenStream=
    ListenStream=14453
    EOF
    

That first ListenStream= is necessary to remove the default port (22). If you don’t do that, the ssh deamon will listen on both port 22 and 14453 (in this example).

Source: https://serverfault.com/a/1159600

Updated:

Comments