This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
ffuseradd.sh
executable file
·88 lines (73 loc) · 1.63 KB
/
ffuseradd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
#NMEUSR=$1
#EMLUSR=$2
#GRPUSR=$3
#ADDUSR="$(which useradd) -m"
# Usage info
#if [ "$NMEUSR" = "" ]; then
# echo -e "\nUSAGE: ffuseradd <USERNAME>... [EMAIL ADDRESS]... [GROUP]... \nUsername is\
# necessary!\nEmail address and group are optional.\nGroups for example: sudo,www-user. Ever add multible groups \",\" separated! Leave it blank for standard user."
# exit
#else
# if [ "$EMLUSR" = "" ]; then
# echo -e "You entered:\n Username: "$NMEUSR"\n Email address: none"
# else
# echo -e "You entered:\n Username: "$NMEUSR"\n Email address: "$EMLUSR""
# fi
#fi
# Adding user
#echo -e "\nadding user "$NMEUSR" with "$ADDUSR" "$GRPUSR" "$NMEUSR""
###################
### UND NOCHMAL ###
###################
usage()
{
cat<<EOF
usage: $0 -u <USERNAME> -[e|g]options
This script adds a new user and includes his public key into the users home
OPTIONS:
-h show this message
-u set username
-e set new users email address
-g set additional group(s) for the new user
EOF
}
NMEUSR=
EMLUSR=
GROUSR=
VERBOSE=
while getopts "h:u:e:g:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
u)
NMEUSR=$OPTARG
;;
e)
EMLUSR=$OPTARG
;;
g)
GRPUSR=$OPTARG
;;
esac
done
if [[ -z $NMEUSR ]] || [[ -z $EMLUSR ]] || [[ -z $GRPUSR ]]
then
usage
exit 1
fi
#while getopts u:e:g: option
#do
# case "${option}"
# in
# u) NMEUSR=${OPTARG};;
# e) EMLUSR=${OPTARG};;
# g) GRPUSR=${OPTARG};;
# esac
#done
#echo $NMEUSR
#echo $EMLUSR
#echo $GRPUSR