Skip to content
BENIBIX Learn

SSH Config File (~/.ssh/config)

Infrastructure🔑 SSH & Remote AccessSSH Basics

Also known as ~/.ssh/config, SSH Client Config, SSH Host Alias

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

Think of it like

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

Example

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

Why it matters

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

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 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.
The small file beside the laptop is the SSH config. It turns a nickname into the full login.

Common mistake

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

Key takeaways

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

Compare

Learn it properly