# SSH
## Generate a Key
Generate with `ssh-keygen -t rsa -C "your_email@example.com"`. Add email/info to act as a label.
Add **public** key (`id_rsa.pub`) to `~/.ssh/authorized_keys`.
## ~~Add to `ssh-agent`~~
- ~~`eval "$(ssh-agent -s)"`~~
- ~~`ssh-add ~/.ssh/id_rsa`~~
## Permissions
- `~` Not writeable by others (probably `0700`)
- `~/.ssh` `0700`
- `~/.ssh/authorized_keys` `0644`
- `~/.ssh/key` `0600`
- `~/.ssh/key.pub` `0644`
Host *
Port 22
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 120
TCPKeepAlive no
# Keep this here, it's (potentially) important
# https://serverfault.com/a/869394
# XAuthLocation /opt/X11/bin/xauth
# Host with X11 forwarding
Host foo
HostName foo.bar
User foobar
ForwardX11 yes
# Might also be needed
# ForwardX11Trusted yes
# Host with no X11 forwarding
Host foo-nox
HostName foo.bar
User foobar