SSH in Plain Words
SSH (Secure Shell) is a protocol for logging in to a remote computer and working on it over an encrypted connection. You run a client on your own computer, it connects to the SSH server on the remote machine, and everything you type and everything the server sends back travels encrypted.
ssh user@your_server_ip
This command opens a shell on the server as user. The full walk-through is in how to SSH into a server.
Client and Server
- Client: the
sshcommand from OpenSSH, included in macOS, Linux, and current versions of other desktop systems, or a graphical client; see how to use PuTTY. - Server: the daemon
sshdon the remote machine. Its service is namedsshon Debian and Ubuntu andsshdon AlmaLinux and Rocky Linux. - Port: the server listens on TCP port 22 unless you change it.
systemctl status ssh
Run on the server, this shows whether the SSH service is active. Its settings live in /etc/ssh/sshd_config.
What Is Encrypted
When a connection starts, client and server agree on a session key that only the two of them know, then encrypt everything that follows: the login, every command, all output, and any files you copy. Someone on the network can see that a connection exists, the two IP addresses and ports, and roughly how much data passes, but not its content.
Host Keys and the First Connection
Every SSH server has its own host key pairs, stored in /etc/ssh. The host key proves to your client that it is talking to the right server and not to a machine in between. The first time you connect, the client has nothing to compare with: it shows the server's key fingerprint and asks whether to continue. If you answer yes, the key is saved in ~/.ssh/known_hosts and checked on every later connection.
To compare the fingerprint before you answer, read it on the server through your provider's console:
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
If the key changes later, for example after a reinstall, the client stops with a warning; see host key verification failed.
Password Login vs Key Login
| Method | How it works | Main risk |
|---|---|---|
| Password | You type the account password | Bots guess passwords all day |
| Key pair | Your client proves it holds a private key | A stolen key file |
With keys, the private key stays on your computer and the public key goes into ~/.ssh/authorized_keys on the server. Create a pair with ssh-keygen and copy it with ssh-copy-id. Once key login works in a second session, you can turn passwords off as described in how to disable SSH password authentication; keep your current session open until the test succeeds.
What Else Runs over SSH
- File transfer: SFTP, scp, and rsync all travel over an SSH connection.
- Tunnels: forward a port, for example to reach a database that listens only on the server itself; see SSH port forwarding.
- Git: push and pull with a key instead of a password, as in GitHub SSH key.
- Remote folders: mount a server directory on your computer with SSHFS.
Shorter Commands and Safer Defaults
An entry in ~/.ssh/config stores the address, user, port, and key for each server, so ssh myserver is enough; see the SSH config file. On the server side, turn off direct root login and block repeated failures, as shown in how to disable root login over SSH.
SSH vs Telnet
Telnet also opens a remote shell, but it sends everything, passwords included, as plain text. SSH replaced it for logins; the telnet command is still useful for testing whether a port answers.