Skip to main content

Plesk

Automate creation of users

create virtual host and create Plesk user.

USERNAME=johndoe
PASSWORD=default-UserPass-1122
EMAILSERVER=mailserver.com

if [ "$1" == "" ]; then
        read -p "Enter username : " USERNAME
else
        USERNAME=$1
fi

if [ "$2" == "" ]; then
        read -s -p "Enter password : " PASSWORD
else
        PASSWORD=$2
fi


plesk bin subscription --create ${USERNAME}.jouw.website -service-plan "Default Domain" -ip 212.227.68.87 -login ${USERNAME} -passwd "${PASSWORD}"
plesk bin user --create ${USERNAME}@${EMAILSERVER} -passwd ${PASSWORD} -cname ${USERNAME} -role ROCvA-student -owner admin -subscription-name ${USERNAME}.jouw.website

Delete Plesk user and virtual host

USERNAME=johndoe
EMAILSERVER=mailserver.com

if [ "$1" == "" ]; then
        read -p "Enter username : " USERNAME
else
        USERNAME=$1
fi


plesk bin user --delete ${USERNAME}@${EMAILSERVER}
plesk bin subscription --remove ${USERNAME}.jouw.website