# authorized_keys

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

**Field:** Infrastructure  
**Category:** SSH & Remote Access  
**Also known as:** authorized_keys File, ~/.ssh/authorized_keys, Authorized Keys, ssh-copy-id

## Think of it like

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

## 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

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

## 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.

## Why it matters

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

## Common mistake

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

## Three principles

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

## Related terms

- [SSH Key Pair](https://learn.benibix.com/term/infrastructure/ssh-key-pair)
- [SSH Public Key Authentication](https://learn.benibix.com/term/infrastructure/public-key-authentication)
- [Secure Shell (SSH)](https://learn.benibix.com/term/infrastructure/ssh)
- [chmod](https://learn.benibix.com/term/infrastructure/chmod)
- [Home Directory (~)](https://learn.benibix.com/term/infrastructure/home-directory)

## Told apart from

- [known_hosts vs authorized_keys](https://learn.benibix.com/compare/known-hosts-vs-authorized-keys): People often think both files hold the same keys. They face opposite ways. known_hosts is on your computer and lists the servers you trust. authorized_keys is on the server and lists the people it lets in. One proves the server to you, the other proves you to the server.

## Taught in

- [SSH Keys and ssh-keygen](https://learn.benibix.com/learn/infrastructure-ssh/ssh-keys-and-ssh-keygen): SSH, 3/9

![A key pair made by ssh-keygen. The private key stays on the laptop in ~/.ssh/id_ed25519, locked with a passphrase, and ssh-agent holds it open for the day. A copy of the public key sits on the server in ~/.ssh/authorized_keys. At login the server sends a challenge, the laptop signs it with the private key, and the server checks the signature with the public key.](https://learn.benibix.com/diagrams/inf3-ssh-keys.svg)

---

Source: https://learn.benibix.com/term/infrastructure/authorized-keys
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.
