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
SERVER=webserver.com
IP=xxx.xxx.xxx.xxx
USER_ROLE=student

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${SERVER} -service-plan "Default Domain" -ip 212.227.68.87${ip} -login ${USERNAME} -passwd "${PASSWORD}"
plesk bin user --create ${USERNAME}@${EMAILSERVER} -passwd ${PASSWORD} -cname ${USERNAME} -role ROCvA-student${USER_ROLE} -owner admin -subscription-name ${USERNAME}.jouw.website${SERVER}

Delete Plesk user and virtual host

USERNAME=johndoeEMAILSERVER=mail.com
EMAILSERVER=mailserver.WEBSERVER=website.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${WEBSERVER}