In this blog post, we will be focusing on how to use OpenSSH on Linux. So let’s get started.
What is OpenSSH?
Short for OpenBSD Secure Shell, OpenSSH is a suite based on SSH (Secure Shell) protocol offering a secure network for services such as remote file transfer. It was initially developed as a part of the OpenBSD operating system.
Features of OpenSSH?
- OpenSSH is easily accessible for everyone, their code supports Reutilization and examining/ auditing of the code.
- OpenSSH has a secure tunnel to forward remote TCP ports via strong encryption (3DES, Blowfish, AES, Arcfour).
- An ad hoc SOCKS (Secure Sockets) proxy server can be created using OpenSSH.
- OpenSSH offers secure communication.
Difference between SSH and OpenSSH
SSH | OpenSSH |
SSH is a closed source cryptographic network protocol | OpenSSH is a free open source protocol based on SSH. |
SSH was initially released in 1995 as SSH-1 protocol, trying to replace TELNET, rlogin, FTP and rsh protocols. | Open SSH was launched in 1999, for developers that needed a free software version. The original 1.2.12 release of SSH was released under open source license. |
Few SSH commands are: ssh-copy-id, Ssh-keygen,ssh-agent, ssh-add, SCP, sftp and sshd | Few commands are : ssh, ssh-keygen, ssh-agent, ssh-keyscan, SCP, sftp and sshd |
Requirements
- Root access to your server
- Terminal (OpenSSH on Linux)
How to enable OpenSSH on Servers
To enable SSH on the server, you need to execute the OpenSSH package. For instance, Apache is a package and daemon is httpd. Likewise, OpenSSH is installed on the server and you utilize this through SSH. At ByteNap, OpenSSH is installed beforehand and available to utilize on all our Linux Hosting servers and Managed Servers and customers have full root access utilizing it. Additionally, it is also found in Reseller Hosting as well as Shared Hosting.
Though OpenSSH comes pre-installed on multiple versions of Linux for both client as well as server-side. Yet if you want to verify if it is installed then you can run the following commands.
Using OpenSSH on Linux
Here to install OpenSSH on Linux, we utilize Ubuntu as an OS on standalone PC.
For Ubuntu/Debian
You need to follow below steps for installing OpenSSH on Linux
Step 1: To install OpenSSH on client-side and server-side
Type the below command in terminal and wait for the packages to get downloaded and installed.
sudo apt-get install -y openssh-server openssh-client
Step 2: Check if the service is running
service sshd status
Step 3: Configuration
Before you do any changes to the configuration file (config) file make sure that it is crucial to make a copy of the original file. So in case of any blunder, you can reuse this and restore the settings.
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original-copy
Here I have added the suffix “original-copy”, so each time I see this file I know it is an original copy of the sshd_config file.
Step 4: Connecting to OpenSSH
- By default the service runs on TCP port 22, you can modify the port as such: Port 13
- For sshd allow public key-based login, modify the below line: “PubkeyAuthentication yes” If this line is already present then ensure that it has not been commented.
- Restart your OpenSSH server so that the modifications done in the config file can take place.
sudo /etc/init.d/ssh restart
- In case you need to have your OpenSSH server display a nice login banner, then you can do so by changing or editing the contents of the issue.net file by
Banner /etc/issue.net
Conclusion
I hope that through this article, you have successfully learned how to use OpenSSH on Linux.