Today, while running Debian I noticed that I was able to run some programs as a normal user. But when I logged in as a super user, the program wont run.
$ gedit starts gedit
# gedit fails giving the following error
No protocol specified
cannot open display:
Run ‘gedit –help’ to see a full list of available command line options.
X authorisation for the superuser seems to be an issue that has been discussed several times. There is a sux command which is technically “su+x authorisation”. I didn’t know about the sux command so I took the longer route:
1. open a console and login as ROOT : su
2. see who can launch an “X program” : xauth list
if you get an error or the list is empty(you dont get anything) then continue to read on-probably this is you solution.
3. open a console and as USER see who is authorized to open the X programs : xauth list
This should give you something like this :
desktop/unix:0 MIT-MAGIC-COOKIE-1 395a5228d995d958a0cc59a5afe9d521
22.214.171.124:0 MIT-MAGIC-COOKIE-1 45891337dd1f30ea26f45bb6b70449b0
desktop:0 MIT-MAGIC-COOKIE-1 370116e6e873fc798aa4f1429f536219
4. now as ROOT add the ones (hostnames) you want to be able to launch X programs on your DISPLAY :
xauth add desktop/unix:0 . 395a5228d995d958a0cc59a5afe9d521
Do the same for the other entries as well(if you want to be able to launch from other hosts too-try adding all if you dont know which one is the correct one).Notice that the long numbers at the end are the same with the users before!ALSO NOTICE THE DOT “.” between the “desktop/unix:0” and the number. Now you should be ok.Try to launch the program as ROOT. Should work