• Unable to init server: Could not connect: Connection refused


    Every time I run Graphical aplication as root, it shown an error.
    for example:
    $ sudo grub-customizer
    No protocol specified
    Unable to init server: Could not connect: Connection refused

    (grub-customizer:9912): Gtk-WARNING **: cannot open display: :0

    and also some application that need a root access cannot be opened, even without a terminal.

    What should I do? I haven’t experienced this in my old laptop with antergos.
    Thank you :'3

  • @Pegasusearl

    @fernandomaroto said in How to disable auto login:

    sudo gedit /etc/lightdm/lightdm.conf

    One should avoid running graphical programs with sudo, better use kdesudo, or gksudo or any xsudo installed on your system (depends on your DE), because using sudo can lead to permission errors.

    EDIT:
    Source (German)
    Source (English)

    • Although one should not use root to run graphical programs, it usually works and does not give such errors, unless you are running in chroot. But just try out one of the commands I mentioned, one of these should already be installed.
  • Sometimes I really need to use GUI as root. Like when I installed gnome theme. $sudo nautilus. I cannot paste gnome theme to the /usr/share directory before.

    My friend told me to use $xhost +, when i need to do that.

    thanks,

  • @Pegasusearl Do you mean you run sudo nautilus as with root privileges or do you run sudo nautilus as normal user? In first case just type nautilus, in second case use gksudo nautilus (on Gnome) or kdesudo (on KDE).

    EDIT:
    Or do you want to use the graphical program on a remote computer?

  • I run sudo nautilus as normal user. $sudo nautilus.
    gksudo: command not found

    actually “$sudo application” works with running “$xhost +” first.

connection18 connect19 unable42 init2 Posts 5Views 6481
Log in to reply