Before we can SSH to our server, we must make sure the SSH server is running. We can use
systemctl to check this:
systemctl status ssh
1 2 3 4 5 6
I have it running on my Ubuntu Server in AWS. This is somewhat obvious to me, however, as I had to SSH in to run the above command. If you've been using the Ubuntu Server VM we created several chapters ago, then your installation should also have an active "OpenBSD Secure Shell Server" installation running. If it doesn't, follow the instructions below to install it.
If you do have SSH running, you can skip these instructions.
Start by installing the package:
sudo apt install openssh-server.
Once that has finished installing, start and enable the service:
sudo systemctl start ssh and
sudo systemctl enable ssh.
Now check that you have SSH running:
systemctl status ssh. You should see an active, running SSH server. It'll be listening on port
TCP/22. We can check that, can't we? Because we've explored network monitoring tools previously:
sudo lsof -i TCP:22
1 2 3 4
And just like that, we have SSH running.