# SSH Config File (~/.ssh/config)

> A file on your own computer. It gives each server a short name and its login.

**Field:** Infrastructure  
**Category:** SSH & Remote Access  
**Also known as:** ~/.ssh/config, SSH Client Config, SSH Host Alias

## Think of it like

Think of it like the contacts list in your phone. You tap a name, and the phone knows the number.

## Definition

The SSH config file is a settings file on your own computer, at ~/.ssh/config. It gives each server a short nickname. Under the nickname you write the address, the user, the port and which key to use. Then ssh and the nickname is all you type. It is for the client, not the server.

## Example

Lucy logs in to three servers each day. She gives each a nickname, so she types ssh shop instead of a long line.

## Example code

```console
$ cat ~/.ssh/config
Host shop
    HostName 203.0.113.10
    User lucy
    IdentityFile ~/.ssh/id_ed25519
$ ssh shop
```

Four lines save the details once. After that, ssh shop is enough.

## Why it matters

It saves typing and stops mistakes, like logging in as the wrong user or with the wrong key.

## Common mistake

Mixing it up with sshd_config. This file sets up your side, and sshd_config sets up the server.

## Three principles

- **Your side.** Lives on the computer you log in from.
- **Nicknames.** One Host block per server.
- **Not sshd_config.** That one is on the server.

## Related terms

- [Secure Shell (SSH)](https://learn.benibix.com/term/infrastructure/ssh)
- [sshd_config](https://learn.benibix.com/term/infrastructure/sshd-config)
- [SSH Key Pair](https://learn.benibix.com/term/infrastructure/ssh-key-pair)
- [Hidden File (Dotfile)](https://learn.benibix.com/term/infrastructure/hidden-file)
- [Home Directory (~)](https://learn.benibix.com/term/infrastructure/home-directory)

## Told apart from

- [SSH Config File vs sshd_config](https://learn.benibix.com/compare/ssh-config-file-vs-sshd-config): People often think these are one file, because the names are so close. ~/.ssh/config lives on your own computer and sets up how you log in. sshd_config lives on the server and sets the rules for who may log in. Editing the wrong one changes nothing you meant to change.

## Taught in

- [The SSH Config File](https://learn.benibix.com/learn/infrastructure-ssh/ssh-config-file): SSH, 5/9

![A laptop on the left runs the ssh command. A locked tunnel runs across the internet to port 22 on a server on the right, where the sshd program answers. Typed commands travel right through the tunnel and the server's replies travel back left. Beside the laptop, a small file marked ~/.ssh/config holds a saved nickname for the server.](https://learn.benibix.com/diagrams/inf3-ssh.svg)

---

Source: https://learn.benibix.com/term/infrastructure/ssh-config-file
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-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
