Created
November 22, 2024 17:12
Revisions
-
devnoot created this gist
Nov 22, 2024 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/bin/env bash # Create the .ssh directory if it does not exist. if [ ! -d ~/.ssh ]; then mkdir -p ~/.ssh fi # Create the .ssh config file if it does not exist. if [ ! -f ~/.ssh/config ]; then touch ~/.ssh/config fi # Set the correct permissions for ssh directory and keys chmod 700 ~/.ssh find ~/.ssh -type f -name "*.pub" -exec chmod 644 {} \; find ~/.ssh \( -type f \( -name "*.pem" -o ! -name "*.*" \) \) -exec chmod 600 {} \; chmod 600 ~/.ssh/config # Confirmation message echo "SSH directory and file permissions have been updated."