The Real Directory and Its Permissions
mkdir -p ~/.ssh && chmod 700 ~/.ssh
700 means only you (the owner) can read, write, or enter this directory — genuinely no one else on the same machine can even list what is inside it.
A Real Key Pair, Two Very Different Files
# On your own machine, this is the real command:
# ssh-keygen -t ed25519 -C "you@example.com"
# Here, we build the same real file structure by hand to inspect it directly:
cat ~/.ssh/id_ed25519.pub # the PUBLIC key — safe to share
The public key is meant to travel — you paste it into GitHub's settings, hand it to a server admin, post it anywhere. On its own, it can verify a signature but never forge one.
Permissions That Actually Matter
chmod 600 ~/.ssh/id_ed25519 # private key: owner read/write only
chmod 644 ~/.ssh/id_ed25519.pub # public key: fine for others to read
ls -l ~/.ssh
Real SSH clients genuinely refuse to use a private key file that is readable by anyone but its owner — loose permissions on a private key are treated as a real security failure, not a formality.
Before your recipe project can push to a real host like GitHub, that host needs a way to know it is genuinely you — without you typing a password every single time. SSH solves this with a real key PAIR: a public key (safe to hand out, even to post publicly) and a private key (never shared, ever). The host keeps a copy of your public key; anything encrypted with it can only be decrypted with the matching private key you alone hold.
One honest note before starting: this training VM is a fully offline sandbox with no network access and no SSH tooling installed at all — confirmed directly, ssh-keygen genuinely does not exist here. That is by design, not a limitation to work around: the real key-generation command (ssh-keygen -t ed25519) and the GitHub upload step happen on your own machine, outside any sandbox. What this lesson builds instead is the real, hands-on file and permission model — genuinely the same structure ssh-keygen itself produces — so the concept is concrete before you ever run the real command elsewhere.
Public key vs private key
Two mathematically related files that work as a real pair: content locked with the public key can only be unlocked with the matching private key. Sharing the public key openly is genuinely safe by design; the private key must never leave the machine it was generated on.
chmod 600 on a private key
Restricts a file to read/write access for its owner only — confirmed directly in this lab via ls -l showing "-rw-------". Real SSH clients enforce this: a private key with looser permissions is treated as compromised and refused.
Takeaways
- A public key is genuinely safe to share anywhere; a private key must never leave the machine that generated it
- ~/.ssh needs mode 700; a private key needs mode 600 — real SSH clients refuse looser permissions on either
- On your own machine, ssh-keygen -t ed25519 -C "you@example.com" generates this exact file pair for real
- GitHub (or any host) only ever needs your public key, uploaded through its own settings page