Skip to content

Instantly share code, notes, and snippets.

@ganey
Created August 9, 2020 07:53
Show Gist options
  • Save ganey/ff75947fd9cfa00382f76eb0c253256f to your computer and use it in GitHub Desktop.
Save ganey/ff75947fd9cfa00382f76eb0c253256f to your computer and use it in GitHub Desktop.
Create cPanel account script - useful when manually restoring accounts
#!/bin/bash
# DEF$1 is the password, so for user cake, the password would become DEFcake.
# To manually add passwords when running the script, change DEF$1 to $2.
et -u
if [ "$1" = "-help" ]
then
echo "Use: ./cpadduser.sh username"
else
/scripts/adduser "$1" /home DEF$1
/scripts/pkgacct $1
/scripts/restorepkg --force /home/cpmove-$1.tar.gz
chown -R $1:nobody /home/$1
chmod -R 0755 /home/$1/public_html
/usr/local/cpanel/bin/rebuild_phpconf 5 none dso 1
/scripts/updateuserdomains
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment