0

I am trying to run nautilus with gksudo nautilus. However, whenever I try, this dialog appears:

enter image description here

Along with the following message in the terminal:

Error copying '/home/.../.Xauthority' to '/tmp/libgksu-v8QBGW': No such file or directory

Then I tried to create a new ~/.Xauthority file by sudo touch ~/.Xauthority. Once I run gksudo nautilus, a dialog asks for my password (also, I cannot write in the textbox, only paste. So I paste my password...)

The following error shows:

Unable to init server: Could not connect: Connection refused

(nautilus:4202): Gtk-WARNING **: cannot open display: :0

I've looked everywhere but cannot find a solution. Also, I cannot open any other visual interface using root, like gksudo synaptic, as the same happens. Please help.

  • 1
    askubuntu.com/questions/961967/… – muru Apr 9 '18 at 8:41
  • Thank you, @muru. I had just solved it by doing "xhost +", then I saw the link you posted, which is more appropriate. I wish I could choose your comment as a correct answer. – lucasdelevy Apr 10 '18 at 6:13
1

As muru suggested with the URL, doing xhost si:localuser:root solved the issue. If he/she wants to answer the question, I will accept it as the correct one.

0

This looks like Ubuntu. I had a similar issue and found out that GDM is starting two Xorg servers (more detail here). What this meant for me was that there were two sockets being created in /tmp/.X11-unix. The value of env var $DISPLAY shows which display gksudo and other graphic applications are using when you try to run them as root from the terminal.

The value ':0' is now pointing to the greeter Xorg instance and the actual user Xorg session is now located at ':1'.

Double check ps aux | grep Xorg then ls /tmp/.X11-unix to see what I mean and if this applies to you. If it does, simply changing the value of $DISPLAY to be ':1' upon login to thwart these display errors is preferred to xhost si:localuser:root which can compromise X11 security.

  • Thanks for your answer. I did what you said and got the error (gksudo:16130): Gtk-WARNING **: cannot open display: 1. When I do ls /tmp/.X11-unix, I get: X0 X1024. So, even changing DISPLAY=1024 gets me the same error. – lucasdelevy May 28 '18 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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