Installing and Configuring OpenSSH on Ubuntu Server
OpenSSH is a freely available version of the Secure Shell (SSH) protocol family of tools for remotely controlling, or transferring files between, computers.
This guide will cover the installation and setup of OpenSSH on Ubuntu Server 16.04 LTS.
It is recommended to update packages before beginning.
Install the OpenSSH client.
Install the OpenSSH server.
/etc/ssh/sshd_config file and protect it from writing with the following commands, issued at a terminal prompt:
This creates a backup of the original configuration for future reference.
/etc/ssh/sshd_config file in the editor of your preference.
To configure OpenSSH to listen on a TCP port other than the default (TCP port 22), change the
To have sshd allow public key-based login credentials, simply add or modify the line:
If the line is already present, then ensure it is not commented out.
To disallow login by the
root user over SSH, change the
To make your OpenSSH server display the contents of the /etc/issue.net file as a pre-login banner, simply add or modify the line:
Save the file and exit the editor.
After making changes to the
/etc/ssh/sshd_config file, save the file, and restart the sshd server application to effect the changes using the following command at a terminal prompt:
Check the contents of the
You may want to insert something like this instead: