Part III · Shell and commands
29. Remote work: SSH and tmux
- 29.1SSH keys and the agentA key pair replaces your password: the private key stays on your machine, the public one (.pub) goes into ~/.ssh/authorized_keys on each server.
- 29.2~/.ssh/config, jump hosts and host keys~/.ssh/config gives each server a short name with its address, user, port and key: ssh db instead of a long command line.
- 29.3SSH tunnels and port forwarding-L: a port on your machine leads to a port reachable from the server. Reach a database that only listens on the server's localhost.
- 29.4tmux: sessions that survive a lost connectionClosing an SSH connection hangs up its shell, and the hang-up signal stops what you started there.
- 29.5Copying files over SSH: scp, sftp and rsyncEverything that copies over SSH uses the same keys and the same ~/.ssh/config names: if ssh db works, scp file db: works.