Skip to content
Toolsintermediate

What is SSH?

Updated Nov 30, 20263 min readBased on official documentation
What is SSH?

In short

SSH, short for Secure Shell, is a network protocol that lets you log in to and run commands on another computer over an encrypted connection. It also lets you copy files securely. OpenSSH is a widely used open source implementation of it.

What SSH does

SSH stands for Secure Shell. It is a protocol, which means a set of rules that two computers follow when they talk to each other. With SSH, you can open a command line on a remote machine as if you were sitting in front of it. Everything you send and receive travels through an encrypted channel, so people on the network cannot read it easily.

The OpenSSH project provides the most common implementation. It includes a client called ssh, a server called sshd, and several helper tools for keys, file copies and transfers.

How it works

The SSH2 protocol, the version used by OpenSSH, is described in the official manual as three layers stacked on top of each other.

The transport layer runs first. The two computers agree on which algorithms to use, then perform a key exchange. During this step the server proves its identity, and the connection becomes encrypted and protected against tampering. Compression is optional.

The user authentication layer runs on top of that secure connection. It lets you prove who you are. Several methods exist, including passwords, public keys and host-based authentication. Public keys are generally the safer choice.

The connection layer runs last. It allows many separate channels to share one authenticated connection. Each channel can carry a login session, a forwarded TCP port or a file transfer. A flow control service keeps the channels from overwhelming each other.

A simple example

To log in to a remote server, you run the client with a user name and a host name:

ssh [email protected]

The first time you connect, ssh shows the server's host key fingerprint and asks you to confirm it. After that, it remembers the key and warns you if it changes.

To copy a file, you can use scp:

scp report.txt [email protected]:/home/alice/

The sftp program offers an interactive, FTP-like way to move files over the same secure channel.

Keys and the agent

A key pair has a private key, which you keep secret, and a public key, which you can place on a server. The ssh-keygen tool creates these pairs. Once the public key is installed on the server, you can log in without typing a password each time.

If your private key is protected by a passphrase, typing it again and again gets tedious. The ssh-agent program is an authentication agent that holds decrypted keys in memory. The ssh-add tool adds keys to it. This way you unlock a key once per session.

Common mistakes

One frequent problem is a server that is not running sshd, or a firewall that blocks the SSH port. Check that the daemon is active and that the port is open before you debug anything else.

Another mistake is editing the server configuration without care. The file sshd_config controls the daemon's behavior, and a wrong edit can lock you out. Keep an open session while you test changes.

Finally, do not ignore host key warnings. A changed key can mean the server was reinstalled, or it can mean someone is intercepting your connection. Verify the change before you accept it.

SSH is not the only way to reach a remote machine. Older tools such as rsh and rlogin sent data without encryption, which is why SSH replaced them in most places. Some teams use VPNs instead, which secure the whole network link rather than individual sessions. For copying files, rsync over SSH is a popular choice when you need to sync directories rather than send a single file.

For most developers, the practical starting point is the ssh client, a key pair, and a clear idea of which server you are connecting to. The official OpenSSH manual pages describe every option in detail and are the best place to look when you need precise behavior.

FAQ

Is SSH the same as Telnet?

No. Telnet sends data without encryption, so passwords and commands can be read by anyone on the network. SSH encrypts the whole connection and is the usual replacement for it.

Do I need a password every time I connect with SSH?

Not necessarily. Public-key authentication lets you log in with a key pair instead. The ssh-agent tool can also hold your unlocked key so you only enter its passphrase once per session.

What is the difference between scp and sftp?

Both copy files over SSH. scp is a simple copy command that works like rcp, while sftp is an interactive, FTP-like program that lets you browse and transfer files step by step.

What should I do when SSH warns that a host key has changed?

Do not accept the new key straight away. Confirm with the server administrator that the change is expected, because a changed key can also signal an attack.

Sources

This page is based on the official documentation below. Read it for full detail.

SSH — official documentation ↗
blozhikDeveloper news from across the web, explained. Every story links to its original sources.