proxmox-management/create_user
2023-10-26 16:45:29 +02:00

22 lines
383 B
Bash
Executable file

#!/bin/sh
set -e
USER="$1@pve"
MAIL="$2"
ORGA="$3"
PASS="$(openssl rand -base64 24)"
usage() {
printf "usage: $0 <username> <mail> <organisation>\n" $0
}
# check usage
[ $# != 3 ] && usage && exit 1
# create user
pveum user add "${USER}" --comment "user account for '${USER}'" --email "${MAIL}" --groups "${ORGA}" --password "${PASS}"
# print password for user
echo "${PASS}"