Skip to content

Instantly share code, notes, and snippets.

@markshust
Last active March 27, 2024 16:52
Show Gist options
  • Save markshust/2561990 to your computer and use it in GitHub Desktop.
Save markshust/2561990 to your computer and use it in GitHub Desktop.
Reset permissions on .ssh directory
chmod 700 ~/.ssh
&& chmod 600 ~/.ssh/id_*
&& chmod 644 ~/.ssh/id_rsa.pub
&& chmod 644 ~/.ssh/known_hosts
&& chmod 600 ~/.ssh/authorized_keys
&& chmod 600 ~/.ssh/authorized_keys2
@revans-premier-education

One liner, also add support for elliptic curve keys..

chmod -f 700 ~/.ssh && chmod -f 600 ~/.ssh/id_* && chmod -f 644 ~/.ssh/id_*.pub && chmod -f 644 ~/.ssh/known_hosts && chmod -f 600 ~/.ssh/authorized_keys && chmod -f 600 ~/.ssh/authorized_keys2

@markshust
Copy link
Author

@revans-premier-education appreciate it, I went ahead and updated the snippet based on this!

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