How to create Xauthority file?

17,161

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.

Share:
17,161

Related videos on Youtube

lucasdelevy
Author by

lucasdelevy

Updated on September 18, 2022

Comments

  • lucasdelevy
    lucasdelevy almost 2 years

    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.

    • muru
      muru about 6 years
    • lucasdelevy
      lucasdelevy about 6 years
      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
    lucasdelevy about 6 years
    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.