21 lines
383 B
Bash
Executable file
21 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}"
|