Last active
September 29, 2021 19:52
-
-
Save hbt/6a91a1458e14e3260953b730e4d947aa to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
cp /var/www/vhosts/hassen.tiltedpixeldev.com/gh.pub /tmp/gh.pub | |
cp /var/www/vhosts/hassen.tiltedpixeldev.com/hbt.pub /tmp/hbt.pub | |
for entry in "/var/www/vhosts"/*pixeldev.com | |
do | |
cd $entry | |
mkdir -p .ssh &> /dev/null | |
chmod 700 .ssh | |
cd .ssh | |
echo "" >> authorized_keys | |
cat /tmp/hbt.pub >> authorized_keys | |
echo "" >> authorized_keys | |
cat /tmp/gh.pub >> authorized_keys | |
chmod 600 authorized_keys | |
cd .. | |
username=$(stat -c "%U" .) | |
chown $username:psacln -R .ssh | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment