Work on remote machines
Connect with SSH keys, copy files, and keep work running with tmux.
- Explain how SSH key authentication works
- Connect and copy files with ssh, scp and rsync
- Keep a session alive through a disconnect with tmux
Most servers have no screen. You reach them with SSH, which gives you an encrypted shell on a machine anywhere in the world: ssh crew@relay.kestrel.example. Once you’re in, everything in this track works the same. What changes is how you get in, and what happens if your connection drops.
Keys beat passwords
Generate a key pair once with ssh-keygen -t ed25519. The private key stays on your machine, and you should never share it. The public key goes on each server, in ~/.ssh/authorized_keys, and ssh-copy-id will put it there for you. When you connect, you prove you hold the private key without ever sending it.
Try it
Up to 15 XPWhat happens when you connect
Step through a key-based login, and predict each stage.
Moving files
scp report.txt crew@relay:/tmp/copies a file. It’s quick for a one-off.rsync -av logs/ crew@relay:backup/logs/copies only what changed, and can resume. It’s the better choice for folders and repeated copies. Mind the trailing slash:logs/means “the contents of logs”.
Put your hosts in ~/.ssh/config and you can type ssh relay instead of the full address:
1Host relay
2 HostName relay.kestrel.example
3 User crew
4 IdentityFile ~/.ssh/id_ed25519tmux: survive a dropped connection
If your connection drops, everything running in that shell usually dies with it. tmux keeps your session running on the server, so you can come back to it:
| Command | What it does |
|---|---|
tmux new -s deploy | Start a session named deploy. |
| Ctrl-B, then d | Detach. It keeps running without you. |
tmux ls | List sessions. |
tmux attach -t deploy | Reconnect to it. |
| Ctrl-B, then % or " | Split the window. |
Rule of thumb: run anything long on a remote machine inside tmux.
Try it
Up to 15 XPAudit this SSH setup
A new engineer describes how they work. Click anything that worries you.
Click every suspicious section. There are 3.
Key takeaways
Use SSH keys, and never share the private half.
Take host key warnings seriously.
rsync beats scp for folders and repeat copies.
Run long remote jobs in tmux.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…