Use the same password and username for ttyd and Linux user

This commit is contained in:
Mo 2023-08-14 03:49:47 +02:00
parent 510d68a7dd
commit f47142bcde

View file

@ -1,7 +1,7 @@
#!/usr/bin/env fish
if test -z "$STUDENT_USER_PASSWORD" || test -z "$TTYD_USER" || test -z "$TTYD_PASSWORD"
echo "Missing environment variables!"
if test -z "$STUDENT_PASSWORD"
echo "The environment variable STUDENT_PASSWORD is missing!"
return 1
end
@ -46,7 +46,7 @@ buildah run builder -- dnf install -y \
buildah run builder -- dnf autoremove -y
buildah run builder -- dnf clean -y all
set -l user_credentials "student:$STUDENT_USER_PASSWORD"
set -l user_credentials "student:$STUDENT_PASSWORD"
buildah run builder -- useradd student
buildah run builder -- bash -c "echo $user_credentials | chpasswd"
buildah run builder -- usermod -aG wheel student
@ -58,7 +58,7 @@ buildah unshare -- sh (status dirname)/buildah_unshare.sh
buildah config \
--workingdir /home/student \
--cmd "bash -c 'chown -R student:student /home/student && runuser -u student -- ttyd -c $TTYD_USER:$TTYD_PASSWORD bash'" \
--cmd "bash -c 'chown -R student:student /home/student && runuser -u student -- ttyd -c student:$STUDENT_PASSWORD bash'" \
builder; or return 1
buildah commit --rm builder ttyd