How to create Xauthority file?











up vote
0
down vote

favorite












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.










share|improve this question


















  • 1




    askubuntu.com/questions/961967/…
    – muru
    Apr 9 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 at 6:13















up vote
0
down vote

favorite












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.










share|improve this question


















  • 1




    askubuntu.com/questions/961967/…
    – muru
    Apr 9 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 at 6:13













up vote
0
down vote

favorite









up vote
0
down vote

favorite











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.










share|improve this question













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.







sudo nautilus






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 9 at 8:25









lucasdelevy

11




11








  • 1




    askubuntu.com/questions/961967/…
    – muru
    Apr 9 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 at 6:13














  • 1




    askubuntu.com/questions/961967/…
    – muru
    Apr 9 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 at 6:13








1




1




askubuntu.com/questions/961967/…
– muru
Apr 9 at 8:41




askubuntu.com/questions/961967/…
– muru
Apr 9 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 at 6:13




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 at 6:13










2 Answers
2






active

oldest

votes

















up vote
0
down vote













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|improve this answer




























    up vote
    0
    down vote













    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.






    share|improve this answer





















    • 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 at 6:37











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436476%2fhow-to-create-xauthority-file%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    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|improve this answer

























      up vote
      0
      down vote













      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|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        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|improve this answer












        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|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 10 at 6:15









        lucasdelevy

        11




        11
























            up vote
            0
            down vote













            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.






            share|improve this answer





















            • 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 at 6:37















            up vote
            0
            down vote













            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.






            share|improve this answer





















            • 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 at 6:37













            up vote
            0
            down vote










            up vote
            0
            down vote









            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.






            share|improve this answer












            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 25 at 20:46









            brianclements

            1335




            1335












            • 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 at 6:37


















            • 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 at 6:37
















            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 at 6:37




            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 at 6:37


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436476%2fhow-to-create-xauthority-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Entries order in /etc/network/interfaces

            新発田市

            Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)