makeuser/makeuser

42 lines
992 B
Plaintext
Raw Normal View History

2018-09-20 15:18:17 +00:00
#!/bin/bash
# ---------------------------------------------------------------------------
2019-03-27 18:28:49 +00:00
# makeuser - tilde new user creation
# Usage: makeuser [-h|--help] <username> <email> "<pubkey>"
2018-09-20 15:18:17 +00:00
# ---------------------------------------------------------------------------
2019-03-27 18:28:49 +00:00
#
# Forked from tilde.team's make user script (
2018-09-20 15:18:17 +00:00
PROGNAME=${0##*/}
2019-03-27 18:28:49 +00:00
VERSION="0.4"
2019-11-05 15:57:19 +00:00
GEN_TDP="./gen_tdp"
2019-12-06 13:01:38 +00:00
CONFIG=./setenv
2019-11-05 15:57:19 +00:00
2019-12-06 13:01:38 +00:00
. $CONFIG
2018-09-20 14:04:19 +00:00
2019-12-12 20:15:11 +00:00
source include/functions
2018-12-15 01:29:03 +00:00
2019-03-27 18:28:49 +00:00
[[ $(id -u) == 0 ]] && error_exit "Do not run this script as root."
2021-01-03 13:09:38 +00:00
[[ $# -ne 3 ]] && error_exit "not enough args"
case $1 in
-h | --help)
usage; exit ;;
-* | --*)
usage; error_exit "unknown option $1" ;;
*)
$(sudo grep -qiw $1 $BANNED) && error_exit "$1 is on the ban list!"
2021-01-03 14:31:52 +00:00
# username passed lowercased
username=$(echo $1 | tr '[:upper:]' '[:lower:]')
#adding new user
2021-01-03 14:31:52 +00:00
makeuser_no_ansible $username $2
add_account_recovery $username $2
2019-03-27 18:28:49 +00:00
#Thunix specific section
2021-01-03 14:31:52 +00:00
makeuser_ansible $username $2
2019-03-27 18:28:49 +00:00
# End Thunix specific section
;;
esac
2018-09-21 14:04:48 +00:00