There are several occasions when we want to use sudo to run graphical applications with administrative permissions, for example: sudo gparted ó Sudo Dolphin
And many will have seen this error:
kzkggaara @ geass: ~ / Downloads $ sudo gparted
No protocol specified(gpartedbin: 6547): Gtk-WARNING **: cannot open display:: 0
Which prevents the application from opening (in this case gparted), a simple step will solve the problem this 😀
We must open a terminal (console, bash, shell, whatever they want to call it ...) and put the following in it:
echo "" >> $HOME/.bashrc && echo "export XAUTHORITY=$HOME/.Xauthority" >> $HOME/.bashrc && cd $HOME && . .bashrc
We push [enter] and voila, it will be solved 🙂
Simple no? HAHA.
regards
17 comments, leave yours
Thanks friend, good and practical tip.
I'm not sure, but I think that this error will appear if "sudo gparted" is used instead of "gksudo gparted" or "kdesudo dolphin", which must be ...
Those you use in Alt + F2, apart from kdesudo I think it is not, it is kdesu
Like is gksu
Yes indeed, it only appears if it is done with sudo, if it is used gksu o kdesudo it won't appear, the problem is that at least in my Arch I don't have the option to use kdesudo, at least I haven't found it 🙁
http://aur.archlinux.org/packages.php?ID=14357 😉 Be careful that the comments are old so the PKGBUILD is very outdated. Don't look to see if it's in the repositories.
It is not the same to launch gksu as gksudo, although for practical purposes it is. It's like using su or sudo, the operation is different; in one you log in to the administrator and in the other you simply give rights to a user. In any case, the important thing is to never launch it as a dry sweat.
I don't like to use packages from the AUR hehe, not to mention that many times I can't (fault of my ISP) 😀
Thanks anyway friend 😉
But doing this is not the most correct, it is better to use kdesu, kdesudo, gksu or gksudo as appropriate 🙂
over here a little explanation that came to mind http://www.kubuntu-es.org/wiki/sistema/por-que-se-debe-usar-kdesu-o-kdesudo-ejecutar-aplicaciones-graficas-terminal-vez-usar-s
Hello Rafael, welcome to our site 😀
The problem with using gksu or kdesudo is that in Arch I don't have them, so I have to resort to sudo.
Greetings and I hope you like our articles 🙂
I get the problem but it is when running google chrome !!
Is there a similar solution !! ???
=S
You run [Alt] + [F2] and open Google Chrome, and you get this error? O_O
Excellent after two years you saved me the night, in other sites they said that it was necessary to turn the system over to make Gparted work as superuser. :3
Thank you.
Greetings.
This same error appears to me, but when I try to install graphically from any bian cd, can someone tell me how to solve it?
Thank you
What is this supposed to do? I have the same error and I think I did things wrong from the beginning, I executed the following: user @ machine: $ rm -rf /tmp/.X0-lock and when I executed user @ machine: $ Xorg -configure I got an error: /
I do not know what to do!!
Thank you very much!
In my case the error appeared when I launched sudo synaptic.
Exactly this appeared:
No protocol specified
Unable to init server: Could not connect: Connection refused
(synaptic: 10216): Gtk-WARNING **: cannot open display:: 0
And before this error I was having problems that .Xauthority did not exist.
Debian 9 + Gnome3.
HAHAAJ thank you very much. But it turns out that if you don't have the .Xauthority it's useless.
But you directed me.
You can use
«`
touch $ HOME / .bashrc
«`
instead of
«`
echo "" >> $ HOME / .bashrc
«`
touch creates an empty file for you if it does not exist, or updates the file's timestamp otherwise (when it does exist), but does not modify the content in either case, only its modification date.