Update as is

parent 2dfa5d22
No preview for this file type
......@@ -10,7 +10,7 @@ d-i keyboard-configuration/xkb-keymap select us
d-i netcfg/choose_interface select auto
# User accounts - predefined (root password set by set_root_password.sh)
d-i passwd/root-password password changeme
d-i passwd/root-password-crypted password $1$aImLCLMx$y.infVof.CnB.nIvN6ER7.
d-i passwd/make-user boolean false
# Time configuration - predefined
......
#!/bin/bash
TARGET_USER="mbetterclient"
SAVE_PATH="/home/$TARGET_USER/screenshot_kiosk.png"
export DISPLAY=:0
# 1. Get the current magic cookie from the active X session
# We use xauth to extract the specific cookie for display :0
# We use 'su' to access the user's running session environment
X_COOKIE=$(su $TARGET_USER -c "xauth list $DISPLAY" | grep $DISPLAY | awk '{print $NF}')
if [ -z "$X_COOKIE" ]; then
echo "Error: Could not retrieve X authority cookie for user $TARGET_USER."
echo "Please ensure 'xauth' is installed (apt install xauth) and the X server is running on :0."
exit 1
fi
rm -f /home/mbetterclient/screenshot*png
# 2. Set up a temporary Xauthority file for our root SSH session to use
export XAUTHORITY=$(mktemp)
xauth add $DISPLAY . $X_COOKIE
# 3. Take the screenshot using the temporary, valid authority
echo "Taking screenshot using temporary X authority..."
if scrot "$SAVE_PATH"; then
echo "Success! Screenshot saved to: $SAVE_PATH"
else
echo "Error: Scrot failed. Check installation and permissions."
fi
# 4. Clean up the temporary Xauthority file
rm "$XAUTHORITY"
unset XAUTHORITY
# Ensure the saved file is owned by the target user for easy access
chown $TARGET_USER:$TARGET_USER "$SAVE_PATH"
......@@ -17,7 +17,7 @@ d-i netcfg/choose_interface select auto
# d-i netcfg/wireless_key string
# User accounts - predefined (root password set by set_root_password.sh)
d-i passwd/root-password password changeme
d-i passwd/root-password-crypted password $1$aImLCLMx$y.infVof.CnB.nIvN6ER7.
d-i passwd/make-user boolean false
# Time configuration - predefined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment