What is SSH (Secure Shell), and How to Enable It?

What is SSH (Secure Shell)?

SSH, also known as Secure Shell or Secure Socket Shell, is a network protocol that provides users, especially system administrators, a secure way to access a computer over an unsecured network. In addition to providing secure network services, SSH generally refers to the entire group of utilities that implement the SSH protocol. Secure Shell provides strong password authentication and Public Key (public key) authentication, as well as encrypted data communication between two computers connecting over an open network, such as the Internet.

In addition to providing strong encryption, SSH is also widely used by network administrators to remotely manage systems and applications and allows people to log on to another computer over the network, manage commands, and move files from one computer to another.

SSH refers to both the encryption network protocol and the set of utilities that implement this protocol. SSH works with the client-server model that connects the Secure Shell client application, which is the end where the session is displayed, to an SSH server, the other end of the session. SSH applications often offer support for application protocols used for terminal emulation or file transfers. SSH is also used to create secure tunnels for other application protocols, for example, X Windows System can also be used to securely run graphical sessions remotely. An SSH server listens for standard Transmission Control Protocol (TCP) port 22 by default.

How SSH Works

SSH was created to replace insecure terminal emulation or login programs such as Telnet, rlogin, and rsh; SSH enables the same functions. SSH also replaces File Transfer Protocol (FTP) and RCP processes.

The most basic use of SSH is to connect to a remote host computer for the terminal session. The format of this command is as follows:

ssh UserName@login.example.com


This command causes the client to try to connect to the server server.example.com using the UserName user ID. If a connection is attempted for the first time between the local host and the server, the public key fingerprint of the remote host computer is requested and requested to establish a connection even though there is no connection in advance.

If you say yes, you will continue the session and the host key is stored in the known_hosts file of the local system. This file is a hidden file stored in a hidden directory named /.ssh/known_hosts in the user's home directory by default. After the host key is stored in the known_hosts file, the client can reconnect directly to that server without any confirmation and the host key verifies the connection.

Using SSH

SSH, which is used in all data centers, is shipped with every Unix, Linux, and Mac server by default. SSH connections have been used to secure many different types of secure communication between the local host and the remote host, including remote access to resources, command execution, software patches and updates, and other administrative tasks. In addition to creating a secure channel between local and remote computers, SSH is also used to manage routers, server hardware, virtualization platforms, operating systems (OS), internal system management, and file transfer applications.

SSH is used to connect to servers, make changes, upload and log out using the relevant tools or directly through the terminal. SSH keys can be used to automate access to servers and are often preferred in scripts, backup systems, and configuration management tools. SSH keys designed to be convenient and operate within the boundaries of the organization offer single sign-on (SSO - Single Sign-on) so that users can move between their accounts without having to enter a password each time.

Although SSH plays an important role in identity management and access management, it can offer more than just authentication over an encrypted connection. All SSH traffic is encrypted; their actions are hidden, however, as if users are transferring a file, browsing the web, or running a command.

Features of SSH

The functions enabled by SSH include:

Secure remote access to SSH-enabled network systems or devices and automated processes for users;
Secure and interactive file transfer sessions;
Automatic and secure file transfers;
Secure commands to remote devices or systems; and
Safe management of network infrastructure components.

SSH can be used interactively to activate terminal sessions and should be used instead of a less secure Telnet program. SSH is also widely used in scripts and other software to enable programs and systems to access data and other resources remotely and securely.

History of SSH

The first version of SSH appeared in 1995 and was designed by Tatu Ylönen, who was a researcher at the Helsinki University of Technology at that time and later founded SSH Communications Security, a Finland-based cybersecurity service provider. Over time, various errors were found in SSH-1, and this version is now deprecated. And it is not safe to use.

The current version of the Secure Shell protocols, SSH-2, was adopted by the Internet Engineering Task Force (IETF) in 2006 by the Internet Standard. SSH-2 is not compatible with SSH-1 and uses a Diffie-Hellman key exchange. It offers a stronger integrity check that uses message authentication codes to increase security. SSH clients and servers use the Advanced Encryption Standard (AES) and Blowfish and many more encryption systems from the most known systems.

So far, there is no known vulnerability in SSH-2, but Edward Snowden has suggested in 2013 that the National Security Agency (NSA) could decrypt some SSH traffic.

SSH Security Issues

Businesses using SSH need to develop some solutions to manage host keys stored on client systems; these keys will accumulate over time, especially for information technology (IT) employees who need to access remote host machines for management purposes. Since the data stored in the SSH known_hosts file can be used to gain authenticated access to remote systems, organizations must be aware of the existence of these files and have a standard process to maintain control over the files even after they stop using a system, because this data may be stored in plain text on hard disks.

Developers should also be careful when including SSH commands or functions in a script or other program type. While it is possible for the user of the local machine to issue an SSH command with a user ID and password to authenticate to an account on the remote host machine, doing so may also cause identification information to an attacker who has access to the source code.

A vulnerability in the shellshock bash command processor can be executed through SSH, but not in SSH, but essentially in Bash. The biggest threat to SSH is bad key management. Unless the existence of the correct central structure, rotation, and removal for SSH keys is ensured, organizations can lose control over who and which source accessed, especially when using SSH in automated processes from application to application.

SSH vs. Telnet Comparison

Telnet is one of the first internet application protocols - the other is FTP, and Telnet is used to start and maintain a terminal session on a remote host computer.

SSH and Telnet are functionally similar, but the primary difference between them is the public key encryption used by the SSH protocol. Thus, a terminal can encrypt session commands and output as well as to authenticate the endpoints when setting up the session.

While Telnet is mainly used for terminal emulation, SSH can be used to emulate like the rlogin command - it is also used for file sending with SSH File Transfer Protocol (SFTP) and for tunneling other applications, to issue remote commands like rsh.

SSH and SSL/TLS Comparison

Transport Layer Security - TLS is designed to provide security for network transmissions on the transport layer by updating the Secure Sockets Layer (SSL) protocol. The SSH protocol also works on the transport layer or just above, but there are significant differences between the two protocols.

While both rely on public/private key pairs to authenticate host computers, under TLS, only the identity of the server is authenticated with a key pair. SSH uses a separate key pair to verify each connection: a key pair for connection from the local machine to the remote machine and a second key pair to verify the connection from the remote machine to the local machine.

Another difference between SSH and TLS is that TLS allows connections to be encrypted without authentication or authenticated without encryption; SSH encrypts and authenticates all connections.

SSH provides IT and information security (infosec) professionals with a secure mechanism to remotely manage SSH clients. Instead of requiring password authentication to initiate the connection between the SSH client and the server, SSH authenticates the devices themselves. This validation allows IT personnel to add or remove host key pairs to the known_hosts file, connect to remote systems, and change SSH configurations.

SSH Application Areas

As an open protocol, SSH is implemented for most computing platforms, and the open-source OpenSSH application is an application, including Apple's macOS, which is most commonly found in Linux, Unix, and other operating systems via Berkeley Software Distribution (BSD).

OpenSSH has been moved to run on Windows PowerShell since 2015, and optional OpenSSH support was added to Windows 10 in 2018. Although SSH is directly accessible by default on most Unix-like operating systems, it must be enabled by you in Windows Settings in the migrated version of Microsoft's OpenSSH.

PuTTY is another open-source application of SSH and is currently available for Windows, macOS, and Unix/BSD, but PuTTY was originally written to run on Windows. It has long been one of the best options for using SSH on a Windows system.

Most applications of the SSH package include three utilities, which are the safe versions of previous unsafe Unix utilities (rlogin, rsh, and RCP), slogin (secure login), ssh, and SCP (secure copy). SSH uses public-key encryption to authenticate the remote computer and, if necessary, allow the remote computer to authenticate the user.

Currently, there are many SSH applications for various platforms, and under various open-source and registered licenses.

SSH Commands

Although SSH has graphic applications, the program is usually called from the command line or executed as part of a script. Running SSH in its command without any arguments like the target host or user ID will bring you a list of SSH command parameters and options.

The most basic form of the SSH command is to call the program and the target host computer name or Internet Protocol (IP) address:

ssh server.example.org


So it connects to the target server.example.org; the target host computer will respond by entering a password for the user ID of the account on which the client is running. In other words, if the user ID in use is smith, the remote host machine will request a password associated with the account named smith.

In most cases, the user ID of the remote host computer will be different, so the command must be issued with the remote host user ID, for example ssh remote_host_userID@server.example.org.

SSH can also be used from the command line to issue a single command on the remote host computer and then exit - for example:

ssh example.org ls


This command runs Unix. The ls command is the command that lists all the contents of the current directory on the remote host machine. While this example is insignificant, it shows that SSH can be used to execute more interesting commands on the remote computer. For example, a command can be created that will launch a server instance that will access the remote machine for a single file or another resource, and then terminate the server after the file is accessed by the specified host computer.

In addition to executable SSH, SSH has other executable commands used on the command line for additional functions, including:

sshd starts the SSH server, which awaits incoming SSH connection requests and enables authorized systems to connect to the local host computer.

ssh-keygen is a program for SSH used to automate sessions, implement SSO, and create a new authentication key pair that can be used to authenticate host computers.

ssh-copy-id is a program used to copy, install, and configure an SSH key to the server to automate unencrypted logins and SSO processes.

SSH-agent is a utility that monitors the ID keys and passwords that SSH generates an encryption key and allows the user to log in to different servers without having to re-enter their passwords or ID keys.

ssh-add is used to add a key to the SSH authentication agent and to implement SSO using SSH with the SSH-agent.

SCP is a program used to copy files from one computer to another and it is a version of Rcp secured with SSH.

Sftp is a program used to copy files from one computer to another and is a more secure version of FTP, the original File Transfer Protocol, with SSH. SFTP has become the preferred mechanism for file sharing over the internet, replacing FTP/S (FTP Secure), which is the protocol for using FTP over the SSL/TLS tunnel, and FTP.
SSH Tunneling

SSH tunneling, also known as SSH port forwarding, is a technique that allows the user to open a secure tunnel between a local computer and a remote host computer.

SSH port forwarding is a technique used to route network traffic to a specific port / IP address to make a remote host computer directly accessible by localhost applications. The specified destination may be on a remote SSH server, or it may be configured to forward to another remote host computer.

SSH tunnels are powerful tools for IT administrators as well as malicious software developers because they can pass an enterprise firewall unnoticed. As a result, various tools are available to prevent unauthorized use of SSH tunnels through the company firewall.