Skip to content

Instantly share code, notes, and snippets.

@mano8
Last active May 25, 2024 11:02
Show Gist options
  • Save mano8/a6e2d3ac28d02fbbca47eb0372b4ad76 to your computer and use it in GitHub Desktop.
Save mano8/a6e2d3ac28d02fbbca47eb0372b4ad76 to your computer and use it in GitHub Desktop.

Revisions

  1. mano8 revised this gist Dec 1, 2022. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion linux ssh.md
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,15 @@ As an exception, if more than one ListenAddress setting is declared,
    the configuration is not migrated because systemd’s ListenStream has different semantics:
    any address configured which is not present at boot time would cause the ssh.socket unit to not start.

    So to change ssh port:
    ```# sudo sudo nano /lib/systemd/system/ssh.socket```
    #Change the following parameter to the port of your choice e.g. 44022
    ListenStream=44022
    #save the file and quit nano editor.
    ```# sudo systemctl daemon-reload```
    ```# sudo systemctl restart ssh```
    ```# sudo netstat -tulpn```

    see:
    - [original source](https://discourse.ubuntu.com/t/sshd-now-uses-socket-based-activation-ubuntu-22-10-and-later/30189)
    - [other source](https://askubuntu.com/questions/928191/how-to-open-a-closed-port-in-ubuntu)
    - [other source](https://askubuntu.com/questions/1439461/ssh-default-port-not-changing-ubuntu-22-10)
  2. mano8 renamed this gist Dec 1, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion linux ssh → linux ssh.md
    Original file line number Diff line number Diff line change
    @@ -21,4 +21,6 @@ As an exception, if more than one ListenAddress setting is declared,
    the configuration is not migrated because systemd’s ListenStream has different semantics:
    any address configured which is not present at boot time would cause the ssh.socket unit to not start.

    see: (original source)[https://discourse.ubuntu.com/t/sshd-now-uses-socket-based-activation-ubuntu-22-10-and-later/30189]
    see:
    - [original source](https://discourse.ubuntu.com/t/sshd-now-uses-socket-based-activation-ubuntu-22-10-and-later/30189)
    - [other source](https://askubuntu.com/questions/928191/how-to-open-a-closed-port-in-ubuntu)
  3. mano8 created this gist Dec 1, 2022.
    24 changes: 24 additions & 0 deletions linux ssh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # Install ssh-server

    ```# sudo apt-get update```
    ```# sudo apt-get install openssh-server```

    See status:
    ```# sudo systemctl status ssh```

    Backup the ssh configuration:
    ```# sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup```

    configure the ssh server:
    ```# sudo nano /etc/ssh/sshd_config```

    **Warning**
    On ubuntu 22.10 SSHd now uses socket-based activation.

    On upgrades from Ubuntu 22.04 LTS, users who had configured Port settings or a ListenAddress setting in
    /etc/ssh/sshd_config will find these settings migrated to /etc/systemd/system/ssh.socket.d/addresses.conf.
    As an exception, if more than one ListenAddress setting is declared,
    the configuration is not migrated because systemd’s ListenStream has different semantics:
    any address configured which is not present at boot time would cause the ssh.socket unit to not start.

    see: (original source)[https://discourse.ubuntu.com/t/sshd-now-uses-socket-based-activation-ubuntu-22-10-and-later/30189]