====== Ubuntu - SSH - Install SSH ======
sudo apt install ssh
----
===== Verify that SSH is running =====
sudo systemctl status ssh
returns:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-11-19 09:47:32 GMT; 2 days ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 885 (sshd)
Tasks: 1 (limit: 9403)
Memory: 7.5M
CGroup: /system.slice/ssh.service
└─885 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
Nov 19 09:47:32 plex systemd[1]: Starting OpenBSD Secure Shell server...
Nov 19 09:47:32 plex sshd[885]: Server listening on 0.0.0.0 port 22.
Nov 19 09:47:32 plex sshd[885]: Server listening on :: port 22.
Nov 19 09:47:32 plex systemd[1]: Started OpenBSD Secure Shell server.
Nov 19 09:48:15 plex sshd[1358]: Accepted password for peter from 192.168.1.69 port 49974 ssh2
Nov 19 09:48:15 plex sshd[1358]: pam_unix(sshd:session): session opened for user peter by (uid=0)
Nov 21 21:24:44 plex sshd[83478]: Accepted password for peter from 192.168.1.69 port 35628 ssh2
Nov 21 21:24:44 plex sshd[83478]: pam_unix(sshd:session): session opened for user peter by (uid=0)
----
===== Start the SSH Service =====
If the service is not running, start it:
sudo systemctl start ssh
----
===== Enable SSH Service to Start on Boot =====
To ensure that the SSH service automatically starts after a reboot, you need to enable it using systemctl.
sudo systemctl enable ssh
----
===== Firewall - Open the SSH port =====
sudo ufw allow ssh
sudo ufw enable
**NOTE:** This configures UFW to allow inbound SSH connections, ensuring that remote attempts to connect to the server via SSH are not blocked by the firewall.
----
===== Test =====
From a remote system, try to connect to this system using SSH:
ssh username@server_ip_OR_hostname
**NOTE:** Replace **username** with the actual username on the system, and **server_ip** with the IP address of the machine being connected to.
----
===== TAGS =====
* TAG: Networking
* TAG: Security
* TAG: Server
* TAG: SSH