Last active
March 11, 2018 11:57
-
-
Save GregBrimble/312e25c94cc77e6242833bdf2cbf78a7 to your computer and use it in GitHub Desktop.
SSH Permissions Fixer
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
echo "Hi, "$USER"! Welcome to the SSH permissions fixer." | |
echo "Fixing '~/.ssh' folder permissions..." | |
chmod -R 700 ~/.ssh | |
echo "Done." | |
echo "Fixing all keys (e.g. '~/.ssh/id_rsa') and their public components (e.g. '~/.ssh/id_rsa.pub')..." | |
chmod 600 ~/.ssh/* && chmod 644 ~/.ssh/*.pub | |
echo "Done." | |
echo "Fixing '~/.ssh/authorized_keys'..." | |
chmod 640 ~/.ssh/authorized_keys | |
echo "Done." | |
echo "Fixing '~/.ssh/known_hosts' and '~/.ssh/config'..." | |
chmod 700 ~/.ssh/known_hosts | |
echo "Done." | |
echo "Complete!" | |
echo "If there is still a problem, check the permissions of your home directory `~`. It should be at least 755." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment