I've automated a daily restart for Firefox (edited by running crontab -e
) and forgot to take into account whether the program would launch with administrator privileges.
killall -s SIGTERM firefox; sleep 15
export DISPLAY=:0.0
firefox -P "user" &
Browsing Javascript webpages as root presumably would be an extremely high security risk — Firefox thankfully seems to reject the request (from a VM):
restorecon: restorecon: SELinux: Could not get canonical path for /root/.mozilla/firefox/* restorecon: No such file or directory.
SELinux: Could not get canonical path for /root/.mozilla/firefox/* restorecon: No such file or directory.
Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /run/user/1000/.mutter-Xwaylandauth.<a potential ID string> which is owned by user.)
Will even web browsers be ran as root by cron? What if the root's crontab was used instead?
cron
has its own environment and does not (by default) have access to any graphical context. Even if it's running as the same user account as the person currently logged on to a GUI – Chris Davies May 14 '22 at 10:44crontab -e
, the user's crontab file. – user598527 May 14 '22 at 11:05export DISPLAY=:0.0
in my script; update the question. – user598527 May 14 '22 at 11:08