22 lines
383 B
Text
22 lines
383 B
Text
|
#!/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}"
|