diff options
author | Christian Rößler | 2015-09-01 13:35:47 +0200 |
---|---|---|
committer | Christian Rößler | 2015-09-01 13:35:47 +0200 |
commit | 73da3c3b1418552ab88ff8e68bfece79de77feb0 (patch) | |
tree | d7cb9c1a912a1aae090722ceda8de4dac66f358f /satellit_installer/includes/10-handle_users.inc | |
parent | [SSPS] Two lefotover bugs (mysql bwlehrpool pass) (diff) | |
download | setup-scripts-73da3c3b1418552ab88ff8e68bfece79de77feb0.tar.gz setup-scripts-73da3c3b1418552ab88ff8e68bfece79de77feb0.tar.xz setup-scripts-73da3c3b1418552ab88ff8e68bfece79de77feb0.zip |
[SSPS] secondary groups possible while adding user
Diffstat (limited to 'satellit_installer/includes/10-handle_users.inc')
-rw-r--r-- | satellit_installer/includes/10-handle_users.inc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/satellit_installer/includes/10-handle_users.inc b/satellit_installer/includes/10-handle_users.inc index 9d46b92..34dc71b 100644 --- a/satellit_installer/includes/10-handle_users.inc +++ b/satellit_installer/includes/10-handle_users.inc @@ -5,9 +5,16 @@ add_group() { } add_user() { - echo -n "# Adding user: $1, uid $2, to gid $3..." - useradd -u "$2" -m -d /home/"$1" -s /bin/bash -g "$3" "$1" 2>/dev/null \ - || perror "Could not add user ${1}/${2} / gid $3!" + echo -n "# Adding user: $1, uid $2, prim. gid $3, optional: other group $4" + + if [ $# -eq 4 ]; then + params=" -u $2 -m -d /home/$1 -s /bin/bash -g $3 -G $4 $1" + else + params=" -u $2 -m -d /home/$1 -s /bin/bash -g $3 $1" + fi + + useradd ${params} 2>/dev/null || perror "Could not add user ${1}/${2} / gid $3 $4" + echo " ok." } |