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.
Installation of ssh server on linux

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.

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment