# SSH Client and Server

> What SSH is. How the ssh command on your laptop talks to sshd on a server, over port 22, on a line nobody else can read.

**Course:** [SSH Keys and Logins](https://learn.benibix.com/learn/infrastructure-ssh)  
**Time:** 10 min

**After this lesson you can:**

- Log in to a server with ssh
- Tell the ssh client from the sshd server
- Say what SSH keeps safe on the way

## How SSH lets you type on a far machine

SSH, short for Secure Shell, lets you log in to a far computer and type commands on it. Everything on the way is locked, so nobody on the line can read it. You type ssh, a user name and an address, such as ssh emma@203.0.113.10. A program on the server answers on port 22 and asks who you are.

Two programs share the work. ssh is the client on your laptop. It sends what you type. sshd is the server program that waits on the far machine. It checks who you are, then starts a shell for you there.

A port is the number that says which program a message is for. One server can run many programs, each on its own port. sshd listens on port 22 unless someone changes it. A website uses 80 and 443.

Once you are in, the window looks the same as a local one. But every command now runs on the server. ls lists the server's files. Closing the window ends the login, and anything you started in it stops too.

SSH locks the line before any password or key is sent. Someone on the same cafe Wi-Fi sees only noise. Older tools like telnet sent every letter in plain text, which is why SSH replaced them.

On almost every Linux server, sshd is already running when you get it. macOS, Linux and Windows 10 and 11 all ship the ssh client. So you can start with no install at all.

A common mistake is to log in as root every time, because the host gave you root first. A mistake made as root can break the whole machine. Make your own user early, and log in as that user.

```console
$ ssh emma@203.0.113.10
emma@web1:~$ hostname
web1
emma@web1:~$ exit
logout
```
Log in, ask the server its name, and log out again. Every command in between ran on web1.

![A laptop on the left runs ssh emma@web1, the client. A locked line across the internet runs to a server on the right, where sshd, the SSH server, waits on port 22. Commands go in and replies come back. Below the laptop, a ~/.ssh/config file holds Host web1 with HostName 203.0.113.10.](https://learn.benibix.com/diagrams/inf3-ssh.svg)

### Example: Lucy fixes her site from a train

Lucy's site shows an error while she is on a train. She has only her laptop and the train's Wi-Fi.

She types ssh lucy@203.0.113.10, restarts the web program, and logs out. It takes 2 minutes, and nobody on the train's network could read a word of it.

**Words in this lesson:** [Secure Shell (SSH)](https://learn.benibix.com/term/infrastructure/ssh), [SSH Server (sshd)](https://learn.benibix.com/term/infrastructure/ssh-server), [Network Port](https://learn.benibix.com/term/infrastructure/port)

**Question:** Which program answers your ssh command on the server?

**Answer:** sshd. ssh is the client you run. sshd is the server program that waits on the far machine, checks who you are and starts your shell.

---

Source: https://learn.benibix.com/learn/infrastructure-ssh/ssh-client-and-server
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
