Skip to content

Instantly share code, notes, and snippets.

@jpSimkins
Last active May 8, 2022 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpSimkins/ef55d44de47c3a52daa62d74d6ab1bf1 to your computer and use it in GitHub Desktop.
Save jpSimkins/ef55d44de47c3a52daa62d74d6ab1bf1 to your computer and use it in GitHub Desktop.
Fix .ssh permissions for all files and sub-directories
sudo chown -R $USER:$USER ~/.ssh
find ~/.ssh -type f -exec chmod 400 -- {} +
find ~/.ssh -type f -name '*.pub' -exec chmod 444 -- {} +
sudo chmod 600 ~/.ssh/authorized_keys
sudo chmod 664 ~/.ssh/config
@jpSimkins
Copy link
Author

jpSimkins commented May 7, 2022

Note: The 400 and 444 for the files is a more secure setup as even you cannot modify these files. You will need sudo to remove them. If you don't like this, you can use 600 and 644 respectively. This will give you write/delete access while still preventing others from messing with them.

This can be run from any location in terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment