Last active
May 8, 2022 18:47
-
-
Save jpSimkins/ef55d44de47c3a52daa62d74d6ab1bf1 to your computer and use it in GitHub Desktop.
Fix .ssh permissions for all files and sub-directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: The
400
and444
for the files is a more secure setup as even you cannot modify these files. You will needsudo
to remove them. If you don't like this, you can use600
and644
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.