SSH
The Secure Shell (SSH) is a cryptographic network protocol used to run network services safely over an unsecured network. Its best-known uses are remote login and command-line execution. For other uses, see SSH (disambiguation).
SSH was designed for Unix-like operating systems to replace Telnet and other unsafe remote Unix shell protocols, such as the Berkeley Remote Shell (rsh) and the related rlogin and rexec protocols. These older tools use insecure, plaintext ways of checking who a user is, such as passwords.
Telnet and Remote Shell are used to control distant computers. Sending login details, such as a username and password, across a public network without protection is risky, because others could learn the password and gain the same access as the user. SSH lowers this risk by using authentication and encryption methods that hide the contents of the transmission from anyone watching, even if they can see the entire data stream.
Finnish computer scientist Tatu Ylönen designed SSH in 1995 and provided it as two commands, ssh and slogin, which were safer replacements for rsh and rlogin. Later developers produced several different versions of the software. The protocol has two major versions, called SSH-1 and SSH-2. The most widely used software is OpenSSH, released as open-source software in 1999 by the OpenBSD developers. Versions are available for all common operating systems, including embedded systems.
SSH uses a client–server architecture, connecting an SSH client with an SSH server. It is built in three main layers. The transport layer provides server authentication, privacy, and data integrity. The user authentication protocol checks the user's identity with the server. The connection protocol multiplexes the encrypted tunnel, splitting it into several separate communication channels.
Definition
SSH uses public-key cryptography to authenticate the remote computer and allow it to authenticate the user, if necessary. In the simplest way, both ends of a connection use automatically made key pairs to protect the network connection, and then use a password to check the user. If a user makes a key pair by hand, the check happens when the pair is created, and a session can open without a password. The public key is placed on every computer that must allow access, and the owner keeps the private key secret. The private key is never sent over the network. SSH only checks that the person offering the public key also owns the matching private key. In every version of SSH, it is important to check unknown public keys, meaning associate the public keys with identities, before accepting them. If an unchecked key from an attacker is accepted, that attacker will be let in as a valid user.
Authentication: OpenSSH key management
On Unix-like systems, the list of allowed public keys is usually kept in a file called ~/.ssh/authorized_keys in the home folder of the user who may log in from far away. SSH only uses this file if no one except the owner and the root user can change it. When the public key is on the remote computer and the matching private key is on your computer, you do not need to type a password. For extra safety, the private key can also be locked with a passphrase.
The private key can be looked for in common places, or its full location can be given as a setting when you run the command. The ssh-keygen tool creates the public and private keys, and it always makes them as a pair.
SSH is usually used to log into a remote computer's shell or command-line interface (CLI) and to run commands on a remote server. It also supports tunneling, forwarding of TCP ports and X11 connections, and it can move files using the SSH File Transfer Protocol (SFTP) or the Secure Copy Protocol (SCP). SSH uses the client–server model. An SSH client program connects to an SSH daemon, such as sshd, which accepts remote connections. Both are common on most modern operating systems, including macOS, most versions of Linux, OpenBSD, FreeBSD, NetBSD, Solaris and OpenVMS. Versions of Windows before Windows 10 version 1709 did not include SSH by default, but proprietary, freeware and open source versions existed (see Comparison of SSH clients). In 2018, Microsoft began adapting the OpenSSH source code for Windows, and Windows 10 version 1709 now includes an official version of OpenSSH.
File managers for UNIX-like systems, such as Konqueror, can use the FISH protocol to show two panes and allow drag-and-drop. The open source Windows program WinSCP offers similar file management, using PuTTY behind the scenes, and both can run from a USB drive without installation. Crostini on ChromeOS includes OpenSSH by default. SSH is also important in cloud computing, where it helps with connections and avoids the security risks of exposing a cloud-based virtual machine directly on the Internet. The IANA has assigned TCP, UDP and SCTP port 22 to SSH, and IANA listed TCP port 22 as one of the well-known ports for SSH servers as early as 2001. The version control system Git is commonly used with SSH, and Git over SSH was once the only secure way to push changes to repositories, because Git over HTTP only allowed read-only access before Git 1.6.6 in 2010.
Historical development
In 1995, a researcher named Tatu Ylönen at Helsinki University of Technology in Finland designed the first version of the protocol, now called SSH-1. He was prompted by a password-sniffing attack on his university network. SSH was meant to replace older protocols such as rlogin, telnet, FTP and rsh, which did not provide strong login security or guarantee privacy. He released it as freeware in July 1995, and it quickly became popular, reaching 20,000 users in fifty countries by late that year. In December 1995, he founded SSH Communications Security to develop it. The early software used free software such as GNU libgmp, but later versions became more and more proprietary software. By 2000, about 2 million people were estimated to be using it. In 2006, a revised version, SSH-2, was adopted as a standard. It offers better security and new features, but it is not compatible with SSH-1. It adds methods such as Diffie–Hellman key exchange, better data integrity checks using message authentication codes like MD5 or SHA-1, and stronger encryption such as AES, which replaced weaker ciphers like 3DES. It also lets users run many shell sessions over one connection. Some versions, including Lsh and Dropbear, later supported only SSH-2. An RFC in 2006 said servers that support both versions should identify themselves as version 1.99, a way of maintaining backward compatibility. In 1999, developers restarted work from the last release of the original program under an open source license, which became the base for Björn Grönvall's OSSH software. OpenBSD developers then forked that code and created OpenSSH, which became the most popular SSH version and dropped SSH-1 support in 2017.
In 2023, an alternative called SSH3 was proposed by PhD student François Michel and Professor Olivier Bonaventure, and its code was made open source. It keeps the original SSH connection ideas but runs on HTTP/3, which uses QUIC. It aims to reduce Round-trip delays and uses TLS 1.3, QUIC and HTTP for security. In 2026, researchers from Stanford University introduced Hop, an open-source remote access protocol that replaces the Trust-On-First-Use (TOFU) model with automatic certificate checking using ACME.
Uses
SSH can be used for many tasks on many systems. These include most Unix-like systems, such as Linux, the BSDs, including Apple's macOS, and Solaris, as well as Microsoft Windows. Some uses need features that only certain SSH programs have. For example, running a VPN over SSH is possible, but for now only with the OpenSSH server and program. Common uses include logging in to a shell on a faraway computer (replacing Telnet and rlogin), running a single command on a faraway computer (replacing rsh), and setting up automatic login without a password (for example, using OpenSSH). SSH can also work with rsync to back up, copy, and mirror files safely and efficiently. Other uses include forwarding a port, and tunneling, which is not the same as a VPN. A VPN routes data between different networks, while tunneling is different, and a bridge joins two broadcast domains into one. Only the OpenSSH server and program support using SSH as a full encrypted VPN. SSH can also forward X from a remote host, even through several hosts. It can help people browse the web through an encrypted connection with SSH programs that support the SOCKS protocol. It can securely mount a folder from a faraway server as a file system on your own computer using SSHFS. It is also used for automatic remote monitoring and management of servers, for development on mobile or embedded devices that support SSH, and for securing file transfer protocols.
SSH is used in several file transfer methods. Secure copy (SCP) grew out of the RCP protocol over SSH. rsync is meant to be more efficient than SCP and usually runs over an SSH connection. SSH File Transfer Protocol (SFTP) is a secure alternative to FTP, but it is not the same as FTP over SSH or FTPS. Files transferred over shell protocol (FISH), released in 1998, grew out of Unix shell commands over SSH. Fast and Secure Protocol (FASP), also called Aspera, uses SSH for control and UDP ports for data transfer.
Architecture
The SSH protocol is built in three layers. The transport layer (RFC) usually uses the Transmission Control Protocol (TCP) of TCP/IP and reserves port number 22 for the server. It handles the first key exchange, checks the server, and sets up encryption, compression, and checks that data is not changed. Keys are exchanged again after 1 GB of data has been sent or one hour has passed, whichever comes first.
The user authentication layer (RFC) checks who is logging in and offers several methods. These include passwords, public-key-based authentication using keys such as ECDSA or RSA, and X.509 certificates. Some methods use one-time password systems like S/Key or SecurID, and GSSAPI methods that work with Kerberos 5 or NTLM to offer single sign-on. The connection layer (RFC) lets many sessions share one SSH connection, a feature similar to BEEP that Transport Layer Security (TLS) does not have. The SSHFP DNS record helps confirm that a host is genuine.
Algorithms
SSH uses many different sets of rules, called algorithms, to keep information safe. For public-key cryptography, it can use EdDSA, ECDSA, RSA, or DSA. For key exchange, which is how two computers agree on secret codes, it can use ECDH or Diffie–Hellman, and key exchange is the name for this step. For MAC checks, it can use HMAC, AEAD, or UMAC.
For symmetric encryption, SSH can use AES. Older methods, such as RC4, 3DES, and DES, are no longer recommended. For AEAD encryption, it can use AES-GCM or ChaCha20-Poly1305. For key fingerprint checks, it can use SHA, while the older MD5 is no longer recommended.
Vulnerabilities
Security weaknesses have been found in SSH over the years. In 1998, a weakness in SSH 1.5 let someone add content to an encrypted connection, because the CRC-32 check it used did not protect data well enough. A fix called SSH Compensation Attack Detector was added to most versions, but many updated versions had a new integer overflow problem that let attackers run harmful code. In January 2001, another weakness let attackers change the last block of an IDEA-encrypted session. SSH-1 has basic design flaws, so it is now generally seen as old, and people should turn off fallback to it. Most modern programs use SSH-2. In 2008, a theoretical weakness was found in all SSH versions that could recover a small part of data encrypted in CBC mode. Using CTR mode instead stops this attack. In 2014, Der Spiegel published leaked documents from Edward Snowden suggesting that the National Security Agency might be able to decrypt some SSH traffic, though the details were not shared. A 2017 review of CIA hacking tools suggested that SSH was not compromised.
Main article: Terrapin attack
In 2023, a new man-in-the-middle attack against most current SSH versions was found and named the Terrapin attack by its discoverers. The risk is limited, because an attacker must intercept a real SSH session, and the attack mostly causes failed connections. SSH developers said its main effect is to weaken the keystroke timing hiding features of SSH. The problem was fixed in OpenSSH 9.6, but both the client and the server must be upgraded for the fix to work fully.
Standards documentation
The IETF "secsh" working group published a series of RFC documents that describe SSH-2 as a proposed Internet standard. These documents explain the main parts of SSH, including how it is designed, how users prove who they are, and how connections are made.
Later, more RFC documents updated these rules and added newer security methods, such as Ed25519 keys. The OpenSSH project also includes its own extra protocol details.

Quiz time!
5 questions about SSH
Why was SSH designed?
Keep exploring
This article is a child-friendly adaptation of the Wikipedia article on SSH, available under CC BY-SA 4.0.
Images from Wikimedia Commons. Tap any image to view credits and license.