bash - Need to run chromium as normal user from root script -
i have kiosk shuts down every day using rtcwake, , uses root user. i've used && execute boot script after rtcwake completes, starts browser root causing problems.
this command use: echo debian | sudo -s rtcwake -m mem -u -t $(date +%s -d '3 days 7:45') && sudo -u debian -i bash $home/kiosk/bin/startup.sh &
.
the sudo command work extent. calls debian user, , executes correct script, however, still screws chromium preferences.
here startup script:
echo debian | sudo -s hwclock -w export home=/home/debian #log boot time echo "booting at" $(date) >> $home/kiosk/bin/logs/boot.log #echo debian | sudo -s service connman restart echo debian | sudo -s @ 15:30 -f $home/kiosk/bin/shutdown.sh crontab -u debian crontab.txt bash $home/git.sh #sudo -i -u debian #start kiosk export display=:0 chromium-browser --kiosk --disable-gpu http://localhost/kiosk/client/main.html & #update ip bash /home/debian/git.sh &
i'm wondering causing chrome executed root. have no idea going wrong.
if execute command sudo
not change environment variables $home
. since per user settings stored in $home
, affects executed program if needs such configuration files. check example:
sudo -u debian bash -c 'echo $home'
it print home folder of calling user, not home folder of user specified trough -u
. sudo
command supports -h
command line option handle this, if works depends on security police in use.
as solution can use su
command instead of sudo
in case:
... && su debian -c chromium
since su
executed root
won't asked password.
Comments
Post a Comment