Ubuntu Server Setup SSH
We start out with a cheat sheet in case you are in a hurry and don't want to read through all of my lengthy descriptions of each step. This will get you started with your Ubuntu Server setup SSH steps (version 16.xx specific).
Jump to - Cheat Sheet
Jump to - Video Instructions
Jump to - Step by Step
We have video instructions of me setting up SSH on Ubuntu Server. Here is our YouTube video of the process:
Step by Step Written Instructions
Ubuntu Server Versions
This setup is demonstrated on Ubuntu Server 16.04. This should work for versions as old as 15.10. For anything older than that it will be slightly different and you will want to use upstart commands instead. Newer versions including 17.xx should work and these steps should probably still be valid until somday systemd is replaced with something else or the package name changes. Basically, anything current should work.
We are going to start off with Ubuntu server running on a VM. It is already logged in on a local console but can’t yet be reached using SSH.
The first thing we are going to do is check the IP address of our server using:
First Connection Attempt
Now we know what IP we want to connect to. Next, we are going to try to use SSH to connect to the server from our desktop using:
It doesn’t work.
Lets check if SSHD is running. We’ll use the ps command and pipe the output to grep like this:
ps -ef |grep -i sshd
Install OpenSSH Server
We’re going to need to install OpenSSH Server. We will do this with the apt-get command like this:
sudo apt-get -y install openssh-server
Now that the daemon is installed we will restart it with the systemd command, like this:
sudo systemctl restart ssh
Lets verify that SSHD is up and running.
ps -ef | grep -i sshd
Now lets verify that it is running on port 22.
netstat -nltp | grep 22
Now were going to try connecting with SSH again.
This time it works.