Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/github_rsa
ssh-add ~/.ssh/mozilla_rsa
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/github_rsa
chmod 644 ~/.ssh/github_rsa.pub
chmod 600 ~/.ssh/mozilla_rsa
chmod 644 ~/.ssh/mozilla_rsa.pub
@saurabh-vijayvargiya

This comment has been minimized.

Copy link

saurabh-vijayvargiya commented Jun 11, 2018

Thanks man, it helped

@Alexandrsv

This comment has been minimized.

Copy link

Alexandrsv commented Jul 9, 2018

Thank

@Emilio66

This comment has been minimized.

Copy link

Emilio66 commented Jul 13, 2018

is that ok to have: chmod 644 ~/.ssh/id_rsa? (private key)

@nre-ableton

This comment has been minimized.

Copy link

nre-ableton commented Jul 27, 2018

@Emilio66 no, otherwise ssh will complain that the permissions are too open.

@madebycollins

This comment has been minimized.

Copy link

madebycollins commented Nov 8, 2018

Thank you so much for this! 🥇

@lkeneston

This comment has been minimized.

Copy link

lkeneston commented Nov 14, 2018

Thanks!

@lipeRomani

This comment has been minimized.

Copy link

lipeRomani commented Nov 20, 2018

Thanks!

@hforbess

This comment has been minimized.

Copy link

hforbess commented Dec 5, 2018

This is very handy. Thanks!

@stephenwoosley

This comment has been minimized.

Copy link

stephenwoosley commented Mar 12, 2019

Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.