How to setup an SSH server on Ubuntu

The SSH network protocol allows users to perform remote operations over a secure connection between two computers on a network. Common uses of SSH include command-line logins, command executions and data communications. The host computer must have an SSH server installed so that it can accept an SSH connection from a client computer. OpenSSH is the most popular software that implements SSH for Linux operating systems such as Ubuntu. Setting up an SSH server on an Ubuntu computer primarily consists of installing OpenSSH and ensuring that an SSH client can connect to the server.
DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
RELATED PRODUCTS Linux-based VPS or dedicated servers

Here is a quick tutorial on how to how to set up an ssh server on Ubuntu.

Install ssh

Run the following command from a terminal window to install ssh with apt while using superuser privileges:

# sudo apt-get install ssh

Press 'Y' when prompted to authorize the use of the indicated storage space for the installation.

Test the ssh installation

Ensure that ssh is working by connecting to your own computer with the following command:

$ ssh localhost

The error message that reads "The authenticity of host 'localhost (' can't be established" means that the ssh client doesn't have the server's encryption key yet. Enter "yes" to continue the login process and enter your password when prompted. If the logon is successful, the ssh client will store the server's encryption key in the local file named ~/.ssh/known_hosts.

Enter exit to return to the local command shell. Enter ssh localhost to sign on to your computer again. Note that the ssh client now has the server's encryption key.

Was This Article Helpful?
Thank You For Your Feedback
Glad we helped! Anything more we can do for you?
Sorry about that. How can we be more helpful?