0

For some specific reasons I need to run evince from command line as root, this is because certain files on my system as so protected that I can only access them via root.

Since by default is not possible to get the file by running the following command logged as root

evince filename.pdf

sometime ago I found the following workround, logged into terminal as root I can open the file with

xhost local:root
DISPLAY=$DISPLAY  evince  filename.pdf 

what happens now is that the above command still work, but it takes like 1minute to open the file, whereas if do

sudo evince filename.pdf 

it does it immediately.

Any explanation?

1 Answer 1

2

First and foremost, it should not be necessary to elevate the Evince GUI to root, and doing so could be a serious security risk. You should ensure that the files you need to manage have the proper permissions and ownership attributes attached to them. You can look into chmod to adjust the permissions for the file and chown to adjust ownership. Setting this properly should ensure you don't need to use sudo evince.

Here's an example, for a file on my system.

To set the file to the proper permissions, I'd use this:

sudo chmod 664 /home/schykle/myfile.pdf

To change my user to the owner of the file, I'd use this:

sudo chown schykle /home/schykle/myfile.pdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.