Secure Shell


The Secure Shell Protocol is a cryptographic network protocol for operating network services securely over an unsecured network. Its most notable applications are remote login and command-line execution.
SSH was designed for Unix-like operating systems as a replacement for Telnet and unsecured remote Unix shell protocols, such as the Berkeley Remote Shell and the related rlogin and rexec protocols, which all use insecure, plaintext methods of authentication, such as passwords.
Since mechanisms like Telnet and Remote Shell are designed to access and operate remote computers, sending the authentication tokens for this access to these computers across a public network in an unsecured way poses a great risk of third parties obtaining the password and achieving the same level of access to the remote system as the telnet user. Secure Shell mitigates this risk through the use of encryption mechanisms that are intended to hide the contents of the transmission from an observer, even if the observer has access to the entire data stream.
Finnish computer scientist Tatu Ylönen designed SSH in 1995 and provided an implementation in the form of two commands, and, as secure replacements for and, respectively. Subsequent development of the protocol suite proceeded in several developer groups, producing several variants of implementation. The protocol specification distinguishes two major versions, referred to as SSH-1 and SSH-2. The most commonly implemented software stack is OpenSSH, released in 1999 as open-source software by the OpenBSD developers. Implementations are distributed for all types of operating systems in common use, including embedded systems.
SSH applications are based on a client–server architecture, connecting an SSH client instance with an SSH server. SSH operates as a layered protocol suite comprising three principal hierarchical components: the transport layer provides server authentication, confidentiality, and integrity; the user authentication protocol validates the user to the server; and the connection protocol multiplexes the encrypted tunnel into multiple logical communication channels.

Definition

SSH uses public-key cryptography to authenticate the remote computer and allow it to authenticate the user, if necessary.
SSH may be used in several methodologies. In the simplest manner, both ends of a communication channel use automatically generated public-private key pairs to encrypt a network connection, and then use a password to authenticate the user.
When the public-private key pair is generated by the user manually, the authentication is essentially performed when the key pair is created, and a session may then be opened automatically without a password prompt. In this scenario, the public key is placed on all computers that must allow access to the owner of the matching private key, which the owner keeps private. While authentication is based on the private key, the key is never transferred through the network during authentication. SSH only verifies that the same person offering the public key also owns the matching private key.
In all versions of SSH it is important to verify unknown public keys, i.e. associate the public keys with identities, before accepting them as valid. Accepting an attacker's public key without validation will authorize an unauthorized attacker as a valid user.

Authentication: OpenSSH key management

On Unix-like systems, the list of authorized public keys is typically stored in the home directory of the user that is allowed to log in remotely, in the file ~/.ssh/authorized_keys. This file is respected by SSH only if it is not writable by anything apart from the owner and root. When the public key is present on the remote end and the matching private key is present on the local end, typing in the password is no longer required. However, for additional security the private key itself can be locked with a passphrase.
The private key can also be looked for in standard places, and its full path can be specified as a command line setting. The ssh-keygen utility produces the public and private keys, always in pairs.

Use

SSH is typically used to log into a remote computer's shell or command-line interface and to execute commands on a remote server. It also supports mechanisms for tunneling, forwarding of TCP ports and X11 connections and it can be used to transfer files using the associated SSH File Transfer Protocol or Secure Copy Protocol.
SSH uses the client–server model. An SSH client program is typically used for establishing connections to an SSH daemon, such as sshd, accepting remote connections. Both are commonly present on most modern operating systems, including macOS, most distributions of Linux, OpenBSD, FreeBSD, NetBSD, Solaris and OpenVMS. Notably, versions of Windows prior to Windows 10 version 1709 do not include SSH by default, but proprietary, freeware and open source versions of various levels of complexity and completeness did and do exist. In 2018 Microsoft began porting the OpenSSH source code to Windows and in Windows 10 version 1709, an official Win32 port of OpenSSH is now available.
File managers for UNIX-like systems can use the FISH protocol to provide a split-pane GUI with drag-and-drop. The open source Windows program WinSCP provides similar file management capability using PuTTY as a back-end. Both WinSCP and PuTTY are available packaged to run directly off a USB drive, without requiring installation on the client machine. Crostini on ChromeOS comes with OpenSSH by default. Setting up an SSH server in Windows typically involves enabling a feature in the Settings app.
SSH is important in cloud computing to solve connectivity problems, avoiding the security issues of exposing a cloud-based virtual machine directly on the Internet. An SSH tunnel can provide a secure path over the Internet, through a firewall to a virtual machine.
The IANA has assigned TCP port 22, UDP port 22 and SCTP port 22 for this protocol. IANA had listed the standard TCP port 22 for SSH servers as one of the well-known ports as early as 2001. SSH can also be run using SCTP rather than TCP as the connection oriented transport layer protocol.

Historical development

Version 1

In 1995, Tatu Ylönen, a researcher at Helsinki University of Technology in Finland designed the first version of the protocol prompted by a password-sniffing attack at his university network. The goal of SSH was to replace the earlier rlogin, TELNET, FTP and rsh protocols, which did not provide strong authentication nor guarantee confidentiality. He chose the port number 22 because it is between telnet and ftp.
Ylönen released his implementation as freeware in July 1995, and the tool quickly gained in popularity. Towards the end of 1995, the SSH user base had grown to 20,000 users in fifty countries.
In December 1995, Ylönen founded SSH Communications Security to market and develop SSH. The original version of the SSH software used various pieces of free software, such as GNU libgmp, but later versions released by SSH Communications Security evolved into increasingly proprietary software.
It was estimated that by 2000 the number of users had grown to 2 million.

Version 2

In 2006, after being discussed in a working group named "secsh", a revised version of the SSH protocol, SSH-2 was adopted as a standard. This version offers improved security and new features, but is not compatible with SSH-1. For example, it introduces new key-exchange mechanisms like Diffie–Hellman key exchange, improved data integrity checking via message authentication codes like MD5 or SHA-1, which can be negotiated between client and server. SSH-2 also adds stronger encryption methods like AES which eventually replaced weaker and compromised ciphers from the previous standard like 3DES. New features of SSH-2 include the ability to run any number of shell sessions over a single SSH connection. Due to SSH-2's superiority and popularity over SSH-1, some implementations such as libssh, Lsh and Dropbear eventually supported only the SSH-2 protocol.

Version 1.99

In January 2006, well after version 2.1 was established, specified that an SSH server supporting 2.0 as well as prior versions should identify its protocol version as 1.99. This version number does not reflect a historical software revision, but a method to identify backward compatibility.

OSSH and OpenSSH

In 1999, developers, desiring availability of a free software version, restarted software development from the 1.2.12 release of the original SSH program, which was the last released under an open source license. This served as a code base for Björn Grönvall's OSSH software. Shortly thereafter, OpenBSD developers forked Grönvall's code and created OpenSSH, which shipped with Release 2.6 of OpenBSD. From this version, a "portability" branch was formed to port OpenSSH to other operating systems.
, OpenSSH was the single most popular SSH implementation, being the default version in a large number of operating system distributions. OSSH meanwhile has become obsolete. OpenSSH continues to be maintained and supports the SSH-2 protocol, having expunged SSH-1 support from the codebase in the OpenSSH 7.6 release.

Future

In 2023, an alternative to traditional SSH was proposed under the name SSH3 by PhD student François Michel and Professor Olivier Bonaventure and its code has been made open source. This new version implements the original SSH Connection Protocol but operates on top of HTTP/3, which runs on QUIC. It offers multiple features such as:
  • Faster session establishment, reducing the number of Round-trip delays from 5-7 to 3.
  • High security: while SSHv2 relies on its own protocols, SSH3 leverages TLS 1.3, QUIC, and HTTP.
  • UDP port forwarding
  • X.509 certificates
  • OpenID Connect
However, the name SSH3 is under discussion, and the project aims to rename itself to a more suitable name. The discussion stems from the fact that this new implementation significantly revises the SSH protocol, suggesting it should not be called SSH3.