mirror of
https://github.com/amkartashov/gf-k8s.git
synced 2026-01-11 09:59:43 +00:00
SSHct: allowed to save user password in /home/.$CTUSER.shadow
File should be owned by root.root and mode should be 640 Otherwise entrypoint.sh will fall back to $CTUSERPWD
This commit is contained in:
parent
18a63fccd9
commit
937f057686
1 changed files with 6 additions and 1 deletions
|
|
@ -11,7 +11,12 @@ update-locale LANG=$CTLOCALE
|
||||||
|
|
||||||
echo "AllowUsers $CTUSER" >> /etc/ssh/sshd_config
|
echo "AllowUsers $CTUSER" >> /etc/ssh/sshd_config
|
||||||
useradd --uid $CTUSERID --user-group --shell /bin/bash $CTUSER
|
useradd --uid $CTUSERID --user-group --shell /bin/bash $CTUSER
|
||||||
echo $CTUSER:"$CTUSERPWD" | chpasswd
|
if [ -f /home/.$CTUSER.shadow -a \
|
||||||
|
"$(stat --dereference --printf='%u %g %a' /home/.$CTUSER.shadow)" == "0 0 640" ]; then
|
||||||
|
echo $CTUSER:"$(cat /home/.$CTUSER.shadow)" | chpasswd -e
|
||||||
|
else
|
||||||
|
echo $CTUSER:"$CTUSERPWD" | chpasswd
|
||||||
|
fi
|
||||||
passwd -u $CTUSER
|
passwd -u $CTUSER
|
||||||
usermod -a -G sudo $CTUSER
|
usermod -a -G sudo $CTUSER
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue