Skip to content
BENIBIX Learn

authorized_keys

Infrastructure🔑 SSH & Remote AccessSSH Key Authentication

Also known as authorized_keys File, ~/.ssh/authorized_keys, Authorized Keys, ssh-copy-id

A file on the server. It lists the public keys that may log in as that user.

Think of it like

Think of it like a guest list at a party door. Your name is on it, so you walk in.

Example

Jack joins Lucy's team. Lucy adds Jack's public key as a new line in authorized_keys, and Jack can log in.

Why it matters

It is the guest list for the server. Removing a line is how you take someone's access away.

Definition

authorized_keys is a file on the server that lists the public keys allowed to log in. It sits in the .ssh folder of the user's home. Each line is one public key. The ssh-copy-id command adds your key to it for you. SSH ignores the file if its rights let other users change it.

Example code

console
$ ssh-copy-id jack@203.0.113.10
Number of key(s) added: 1
One command adds Jack's public key to the list on the server.
The public key lives on the server in authorized_keys. That line is what lets the laptop in.

Common mistake

Loose rights on the file or the .ssh folder. SSH then refuses the key, and the login asks for a password.

Key takeaways

  1. 1
    On the server. In the user's .ssh folder.
  2. 2
    One key per line. Remove a line to remove access.
  3. 3
    Tight rights. Only the owner may write it.

Compare

Learn it properly