# generate key
ssh-keygen -t rsa -b 4096 -C "<your_email@example.com>"
# ensure ssh agent is running
eval "$(ssh-agent -s)"
# add key to agent
ssh-add -K ~/.ssh/id_rsa # macOS
ssh-add ~/.ssh/id_rsa # linux
# print public key to terminal for copying
cat ~/.ssh/id_rsa.pub
# share key to server
ssh-copy-id -i ~/.ssh/id_rsa.pub <USER>@<IPADDR>
# or with windows powershell
cat ~\.ssh\id_rsa.pub | ssh <USER>@<IPADDR> "cat >> .ssh/authorized_keys"
Last active
March 14, 2021 19:04
-
-
Save ahgraber/e36c92e360e2f292e3cc47a3d48703b3 to your computer and use it in GitHub Desktop.
SSH keys
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment