Thursday, October 10, 2019

Running a Graphical Application as root on Fedora

If you, as a regular user, want to run a graphical application with root privileges, you can do the following from your account:

First check you belong to the wheel group (you can invoke sudo).

Create a file with the following script in a file named, for example, wsudo:

#!/bin/bash
# -*- ENCODING: UTF-8 -*-
#small script to enable root access to x-windows system 
xhost +SI:localuser:root
notify-send "ALERT: Enable root user on xhost"
beesu $1
#disable root access after application terminates
xhost -SI:localuser:root
#print access status
notify-send "Disable root user on xhost"

Export the display:
> export DISPLAY=:0.0

then run the graphical application like this:
> ~/bin/wsudo appname

You will be prompted for your password and you're done!

No comments: