From 19c6f692b6e9b744b36cee524e518ece71411513 Mon Sep 17 00:00:00 2001 From: "Simental Magana, Marcos" Date: Mon, 8 Oct 2018 10:49:41 -0500 Subject: [PATCH] Document how to change OpenSSH default port. This commit documents how to change the OpenSSH port on Clear Linux*. Clear Linux* enables an `sshd.socket` systemd unit, which listens in port 22 by default. This commit fixes #261 Signed-off-by: Simental Magana, Marcos --- .../reference/bundles/openssh-server.rst | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/source/clear-linux/reference/bundles/openssh-server.rst b/source/clear-linux/reference/bundles/openssh-server.rst index 99e6d80d..0d63a725 100644 --- a/source/clear-linux/reference/bundles/openssh-server.rst +++ b/source/clear-linux/reference/bundles/openssh-server.rst @@ -8,6 +8,46 @@ Remote users require a SSH service to be able to use an encrypted login shell. The first time OpenSSH starts, it generates the server SSH keys needed for the service. +|CL| enables the `sshd.socket` unit, which will listen on port 22 by default and +start the openssh service as required. + +Change Default Port +=================== +In order to change the default listen port for the OpenSSH\* service, perform +the following steps: + +#. Edit the sshd.socket unit file, provide the `ListenStream` option in the + `[Socket]` section with no value in order to remove the |CL| default port + value, then provide the `ListenStream` option again with the new default + port to listen. In this example, we change `ListenStream` to + listen on port 4200 instead of the |CL| default: + + .. code-block:: console + + # systemctl edit sshd.socket + +#. Verify your changes: + + .. code-block:: console + + # cat /etc/systemd/system/sshd.socket.d/override.conf + [Socket] + ListenStream= + ListenStream=4200 + +#. Reload the systemd daemon configurations: + + .. code-block:: console + + # systemctl daemon-reload + +#. Restart the sshd.socket unit: + + .. code-block:: console + + # systemctl restart sshd.socket + + SFTP ====