Plesk
Automate creation of users
create virtual host and create Plesk user.
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}.${SERVER} -service-plan "Default Domain" -ip ${ip} -login ${USERNAME} -passwd "${PASSWORD}"
plesk bin user --create ${USERNAME}@${EMAILSERVER} -passwd ${PASSWORD} -cname ${USERNAME} -role ${USER_ROLE} -owner admin -subscription-name ${USERNAME}.${SERVER}
Delete Plesk user and virtual host
EMAILSERVER=mail.com
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}.${WEBSERVER}