I can use gedit open file in terminal,but when I close the terminal ,I gedit the file ,then show :error: XDG_RUNTIME_DIR not set in the environment.
(gedit:10183): Gtk-WARNING **: cannot open display:
hadoop@hadoop1:~$
I can use gedit open file in terminal,but when I close the terminal ,I gedit the file ,then show :error: XDG_RUNTIME_DIR not set in the environment.
(gedit:10183): Gtk-WARNING **: cannot open display:
hadoop@hadoop1:~$
When you run software as another user you're in fact starting the new minimal and isolated environment that doesn't carry on some "excessive" variables (among others variables responsible for injecting libraries or setting certain 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
for root
sudo pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY nautilus
Taken from here : https://askubuntu.com/a/467994/185132
Same like m3asmi said but with gedit and not nautilus:
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gedit
for root
sudo pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gedit