forked from evolix/evoadmin-web
Use same UID/GID in containers
This commit is contained in:
parent
0968dbc797
commit
c166975d46
|
@ -271,12 +271,17 @@ create_www_account() {
|
||||||
usermod -g www-data $in_login
|
usermod -g www-data $in_login
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get uid/gid for newly created accounts
|
||||||
|
uid=$(id -u $in_login)
|
||||||
|
gid=$(id -g $in_login)
|
||||||
|
www_uid=$(id -u www-$in_login)
|
||||||
|
|
||||||
# Create users inside all containers
|
# Create users inside all containers
|
||||||
for php_version in ${PHP_VERSIONS[@]}; do
|
for php_version in ${PHP_VERSIONS[@]}; do
|
||||||
#lxc-attach -n php${php_version} -- /usr/sbin/adduser --firstuid $FIRST_UID --lastuid $LAST_UID --gecos "User $in_login" --disabled-password "$in_login" --shell /bin/bash $OPT_UID $OPT_UID_ARG --force-badname --home "$HOME_DIR_USER" >/dev/null
|
lxc-attach -n php${php_version} -- /usr/sbin/addgroup "$in_login" --gid $gid --force-badname >/dev/null
|
||||||
lxc-attach -n php${php_version} -- /usr/sbin/adduser --gecos "User $in_login" --disabled-password "$in_login" --shell /bin/bash $OPT_UID $OPT_UID_ARG --force-badname --home "$HOME_DIR_USER" >/dev/null
|
lxc-attach -n php${php_version} -- /usr/sbin/adduser --gecos "User $in_login" --disabled-password "$in_login" --shell /bin/bash --uid $uid --gid $gid --force-badname --home "$HOME_DIR_USER" >/dev/null
|
||||||
lxc-attach -n php${php_version} -- [ -z "$in_sshkey" ] && echo "$in_login:$in_passwd" | chpasswd --md5
|
lxc-attach -n php${php_version} -- [ -z "$in_sshkey" ] && echo "$in_login:$in_passwd" | chpasswd --md5
|
||||||
lxc-attach -n php${php_version} -- /usr/sbin/adduser --disabled-password --home $HOME_DIR_USER/www --no-create-home --shell /bin/false --gecos "WWW $in_login" www-$in_login $OPT_WWWUID $OPT_WWWUID_ARG --ingroup $in_login --force-badname >/dev/null
|
lxc-attach -n php${php_version} -- /usr/sbin/adduser --disabled-password --home $HOME_DIR_USER/www --no-create-home --shell /bin/false --gecos "WWW $in_login" www-$in_login --uid $www_uid --ingroup $in_login --force-badname >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
sed -i "s/^AllowUsers .*/& $in_login/" /etc/ssh/sshd_config
|
sed -i "s/^AllowUsers .*/& $in_login/" /etc/ssh/sshd_config
|
||||||
|
|
Loading…
Reference in a new issue