Skip to content

Instantly share code, notes, and snippets.

@hbt
Last active September 29, 2021 19:52
Show Gist options
  • Save hbt/6a91a1458e14e3260953b730e4d947aa to your computer and use it in GitHub Desktop.
Save hbt/6a91a1458e14e3260953b730e4d947aa to your computer and use it in GitHub Desktop.
#!/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