Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
24
rated 0 times [  24] [ 0]  / answers: 1 / hits: 222142  / 1 Year ago, fri, april 28, 2023, 4:59:26

I am attempting to run nautilus as root but when I run "sudo nautilus" from the terminal, I get the following error:




error: XDG_RUNTIME_DIR not set in the environment.



(nautilus:9341): Gtk-WARNING **: cannot open display:




The issue does not occur when I attempt to run nautilus as non-root. I am using ubuntu 14.04. Does anyone know how I can fix this?


More From » nautilus

 Answers
1

When you run software as another user you're in fact starting a new minimal isolated environment that doesn't carry on some "excessive" variables (among others variables responsible for injecting libraries or setting privileges). Replace your sudo nautilus call with the following - it will carry on user-specific X server settings from the current session:


pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY nautilus

This is a one time low level solution but it will work on a misconfigured machine. If you want to permanently "fix your sudo" you need to find the issue with your environment configuration and correct it as described in other answers.


[#25611] Sunday, April 30, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shionnky

Total Points: 276
Total Questions: 104
Total Answers: 108

Location: Montenegro
Member since Thu, Jun 16, 2022
2 Years ago
shionnky questions
;