Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76f9056069 | ||
|
|
74e7e9823f |
@@ -234,11 +234,11 @@ while read -r i; do
|
|||||||
fi;
|
fi;
|
||||||
ssh_group="ssh${ssh_access_type}";
|
ssh_group="ssh${ssh_access_type}";
|
||||||
# sshallow group is always added
|
# sshallow group is always added
|
||||||
sub_group_opt=" -G ${ssh_group}";
|
sub_group_opt=("${ssh_group}");
|
||||||
# check if "," inside and extract sub groups
|
# check if "," inside and extract sub groups
|
||||||
if [ -z "${_group##*,*}" ]; then
|
if [ -z "${_group##*,*}" ]; then
|
||||||
sub_group=$(echo "${_group}" | cut -d "," -f 2-);
|
sub_group=$(echo "${_group}" | cut -d "," -f 2-);
|
||||||
sub_group_opt=" -G ${ssh_group},${sub_group}";
|
sub_group_opt+=("${sub_group}");
|
||||||
fi;
|
fi;
|
||||||
# POS 5: do we have a password preset
|
# POS 5: do we have a password preset
|
||||||
_password=$(echo "${i}" | cut -d ";" -f 5);
|
_password=$(echo "${i}" | cut -d ";" -f 5);
|
||||||
@@ -314,11 +314,17 @@ while read -r i; do
|
|||||||
echo "-- Skip '${username}:${group}(${sub_group})'";
|
echo "-- Skip '${username}:${group}(${sub_group})'";
|
||||||
else
|
else
|
||||||
echo "++ Create '${username}:${group}(${sub_group})'";
|
echo "++ Create '${username}:${group}(${sub_group})'";
|
||||||
|
params=(
|
||||||
|
"-c" "$(date +"%F")" "-s" "${user_login_shell}"
|
||||||
|
"-g" "${group}" "-G" "$(IFS=, ; echo "${sub_group_opt[*]}")"
|
||||||
|
"-d" "${HOME_FOLDER}${username}" "-m"
|
||||||
|
"${username}"
|
||||||
|
);
|
||||||
if [ ${TEST} -eq 0 ]; then
|
if [ ${TEST} -eq 0 ]; then
|
||||||
# comment is user create time
|
# comment is user create time
|
||||||
useradd -c "$(date +"%F")" -s "${user_login_shell}" -g "${group}${sub_group_opt}" -d "${HOME_FOLDER}${username}" -m "${username}";
|
useradd "${params[@]}";
|
||||||
else
|
else
|
||||||
echo "$> useradd -c \"$(date +"%F")\" -s \"${user_login_shell}\" -g \"${group}${sub_group_opt}\" -d \"${HOME_FOLDER}${username}\" -m \"${username}\"";
|
echo "$> useradd ${params[*]}";
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
# set the auth file
|
# set the auth file
|
||||||
|
|||||||
Reference in New Issue
Block a user