ssh key
SSH key: secure authentication for remote access
An SSH key is a cryptographic key pair used for authentication when using the SSH protocol (Secure Shell). Unlike using a username and password, where the data is sent over the network (even if encrypted), SSH key authentication uses asymmetric cryptography: a public key and a private key. This system significantly increases the security of remote access to servers and is now a standard practice in managing Linux systems, networks, and cloud environments.
The SSH protocol itself was developed in 1995 by Tatu Ylönen, a researcher at Helsinki University of Technology in Finland. The reason for its development was a password-sniffing attack on the university network, in which passwords could be intercepted because old protocols such as Telnet and rlogin sent their data in unencrypted form. SSH solved this by encrypting all communication between client and server. From July 1995, the first implementation was released as freeware, and soon it had 20,000 users in 50 countries worldwide by the end of 1995. This shows how quickly the need for secure network communication was recognized.
The operation of an SSH key is based on asymmetric encryption. The user generates a key pair: a private key that must be stored securely (usually on the local machine), and a public key that is placed on the server. When a client tries to connect to an SSH server, the server sends a challenge that can only be answered with the corresponding private key. If the client responds successfully, access is granted without having to type a password. This process is not only more secure — because no password travels over the network — but also more efficient, especially in automation and script usage.
Several algorithms are available for generating SSH keys, including RSA, ECDSA, and Ed25519. Ed25519 is often recommended nowadays because of its strong security and fast performance. The use of older algorithms such as RSA with keys of less than 2048 bits is discouraged, because they can be vulnerable to modern attacks. The choice of algorithm affects both security and compatibility with older systems.
To generate an SSH key, a user usually uses the command `ssh-keygen` on a Linux or macOS terminal. This command creates a key pair by default in the `~/.ssh/` directory, with the private key stored as `id_rsa` or `id_ed25519` and the public key as `id_rsa.pub` or `id_ed25519.pub`. It is essential that the private key is never shared and that the file permissions are set correctly (usually `600`) to prevent unauthorized access.
After the key is generated, the public key must be copied to the target server. This is often done with the command `ssh-copy-id user@host`, which automatically adds the public key to the `~/.ssh/authorized_keys` file on the server. From that moment on, the user can log in without a password, provided the corresponding private key is available on the client. Alternatives such as manually copying the key or using GUI tools such as Keymaker or Passwords and Keys (from the GNOME project) offer extra user convenience, especially for less experienced users.
An important advantage of SSH key authentication is that it greatly limits the attack possibilities for brute-force and phishing attacks. Without the private key, an attacker cannot log in, even if a user's password is known. Nevertheless, it is not a guarantee against all risks. If a private key is stolen or stored in an insecure location, it can be misused. Therefore, it is often recommended to protect the private key with a passphrase. This adds an extra layer of security: even if the key files fall into the hands of an attacker, the passphrase is needed to use them.
Tools such as SSH-MITM (SSH Man-in-the-Middle) demonstrate how critical it is to pay attention during key verification. SSH-MITM is a tool for security audits that simulates a man-in-the-middle attack between client and server. It can be used to test whether systems respond correctly to unauthorized servers, for example by detecting unexpected changes in host keys. When a user connects to an unknown server for the first time, SSH asks for confirmation of the server's public key. This is an important security measure against spoofing, but it is often ignored in production environments, which entails risks.
The rise of OpenSSH has greatly promoted the spread of SSH key authentication. The OpenBSD project released OpenSSH in 2000 as part of OpenBSD 2.6, after development had started in 1999. OpenSSH was developed by, among others, Theo de Raadt, Markus Friedl, and Damien Miller and has since become the standard implementation of SSH on virtually all Unix-like systems, including Linux, macOS, and modern Windows versions (via WSL or OpenSSH for Windows). The availability of a free, open-source implementation has contributed to the transparency, security, and breadth of application of the protocol.
In 2006, the specifications of SSH-2 were standardized in RFC 4251 through RFC 4254, which was an important step in the professionalization and interoperability of the protocol. SSH-2, which was introduced in 1996 as the successor to SSH-1, is not compatible with the first version and resolves security weaknesses in SSH-1. The use of SSH-1 is strongly discouraged; modern systems often no longer support it. SSH-2 supports not only better encryption, but also advanced functionalities such as port forwarding, tunneling and agent forwarding.
Agent forwarding allows users to make their SSH agent (which manages private keys) available on an intermediate server, so that they can connect to further systems without physically transferring the keys. This is useful in chains of servers, but should be used with caution, because an attacker on the intermediate server can gain access to the agent if it is not properly secured.
Various utilities exist that simplify the management of SSH keys. Keymaker offers a graphical interface for generating, managing and deploying keys without having to use the command line. Passwords and Keys (also known as Seahorse) is a GNOME application that manages not only SSH keys, but also PGP keys and passwords. Tools such as SSH Pilot and Projectpad go a step further by integrating SSH connections into a broader workflow for server management, with features such as tabs, file management via SFTP, and execution of commands on multiple machines.
John the Ripper CE also plays a role in the security of SSH keys, albeit indirectly. It is a password cracker that can, among other things, analyze SSH private keys for weak passphrases. This makes it a valuable tool for security audits: if a key with a weak passphrase can be cracked, the system is vulnerable.
In summary, the SSH key is a fundamental part of modern system administration and network security. It offers a secure, efficient and automation-friendly way to gain access to remote systems. From the first development by Tatu Ylönen in 1995 to the broader adoption via OpenSSH and the current ecosystems of management tools, the technology remains essential for anyone who works with servers, containers, databases or cloud infrastructure. Precisely through correct use and strict management of keys, the integrity and confidentiality of systems can be guaranteed.