1
0

jump box - add target user to sudoers and handling for on-boot script
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
2026-09-26 14:17:38 -05:00
parent 47c0735345
commit 5af01cc909

View File

@@ -21,6 +21,17 @@ chown "$TARGET_USER":"$TARGET_USER" /var/log/container-stdout.log
# This only really matters for the first-run: # This only really matters for the first-run:
chown "$TARGET_USER":"$TARGET_USER" "/home/$TARGET_USER" chown "$TARGET_USER":"$TARGET_USER" "/home/$TARGET_USER"
# Make the target user a sudoer:
echo "$TARGET_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/target-user
chmod 440 /etc/sudoers.d/target-user
visudo -cf /etc/sudoers.d/target-user
# If the target user has an on-boot script defined, run it:
if [ -f "/home/$TARGET_USER/.on-boot.sh" ]; then
echo "Running on-boot script..."
sudo -u "$TARGET_USER" "/home/$TARGET_USER/.on-boot.sh"
fi
echo "Ready." echo "Ready."
tail -f /var/log/container-stdout.log & tail -f /var/log/container-stdout.log &