jump box - add target user to sudoers and handling for on-boot script
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
This commit is contained in:
@@ -21,6 +21,17 @@ chown "$TARGET_USER":"$TARGET_USER" /var/log/container-stdout.log
|
||||
# This only really matters for the first-run:
|
||||
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."
|
||||
tail -f /var/log/container-stdout.log &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user