Skip to content

Instantly share code, notes, and snippets.

@the-paulus
Created May 25, 2017 18:24
Show Gist options
  • Save the-paulus/d06f3a75a9c993a579ea102fe52a1c5d to your computer and use it in GitHub Desktop.
Save the-paulus/d06f3a75a9c993a579ea102fe52a1c5d to your computer and use it in GitHub Desktop.
Copies ssh authorized keys to each cPanel user account.
for user in $(cat /etc/domainusers | cut -d: -f 1)
do
if [ ! -d /home/$user/.ssh ]
then
mkdir /home/$user/.ssh
chown "$user":"$user" /home/$user/.ssh
fi
cp /root/.ssh/authorized_keys /home/$user/.ssh
chown "$user":"$user" /home/$user/.ssh/authorized_keys
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment