If you have used Linux or other Unix-based operating systems (like FreeBSD or Mac OS X), you might be familiar with SSH, Telnet, or both. They are used for accessing systems remotely through the command line interface (CLI).
Although they are often used interchangeably, they have several feature differences, which makes them suitable for different use cases.
Most of the time, you will be using SSH for doing remote access.
So, What is SSH?
SSH, or Secure Shell, is a secure protocol allowing you to control remote systems. SSH clients are available for various operating systems, such as Windows, Mac, and Linux. The service runs on port 23, but system administrators could change the port to other ports for security reasons.
To further secure the communication through it, SSH protocol is also encrypted through the use of public and private key pairs, which makes it suitable for controlling remote systems over the internet. With the applied encryption, it is very hard for attackers to intercept your SSH communication. The security of SSH introduces some overhead in the network, but with the abundance of high-speed internet, the overhead has become a moot point nowadays.
Server App Used for SSH
There are various server programs supporting the SSH protocol, which will allow you to connect to your machine through the internet. On Debian-based Linux systems, the preferred SSH server program is OpenSSH, which can be installed through the command below:
$ sudo apt-get install openssh-server
Alternatively, Dropbear SSH could also be used as SSH server. With its lighter footprint, Dropbear SSH has become a telnet alternative for embedded devices, such as routers and Raspberry Pi. You can install Dropbear SSH by issuing this following command on a Debian-based Linux system:
$ sudo apt-get install dropbear
On the other hand, if you need to control a computer that is on your local network, you can use Telnet. Originally written as a means to connect remote terminals to big mainframes in the 1960s, nowadays Telnet is still used by some Unix purists and embedded device makers. The continued use of Telnet is due to its speed – without encryption overhead, Telnet is potentially faster than SSH.
However, the nature of Telnet makes it insecure and unsuitable to control your device through the internet. Telnet is an old protocol without a security mechanism, and as such, all your communication to the server is sent in plain text forward. As such, malicious parties could sniff your network traffic to find out and intercept the command you send to the remote machine.
Server App Used for Telnet
Telnet usually runs on port 23 and is served by xinetd daemon. If you intend to use telnet to control your Unix-based system, you need to install and enable xinetd and telnetd first. Installing both programs are also easy – if you have a Debian-based Linux system, such as Ubuntu or Linux Mint, you can install Telnet by using this command below:
$ sudo apt-get install xinetd telnetd
To sum up, the differences between SSH and Telnet boils down to security. Most modern SSH clients, such as PuTTY for Windows, could also connect to Telnet servers. To strengthen the notion, most security best practices advised that you turn off Telnet on your server to protect it against malicious users.
SSH vs Telnet Feature Differences
This following table explains how SSH and Telnet stack off against each other:
|Security||Encryption through private and public key||No security protocol|
|Network overhead||Introduces a little bit of network overhead for security||No network overhead|
|Usage||Controlling to remote machines over insecure networks, such as internet||Connecting to machines in a local/trusted network or to embedded/IoT computers.|
Hopefully you now understand what is the different between SSH and Telnet.