When I am running some software using sudo command it showing error like
cannot connect to X server
For example if I run the following command:
$ sudo gedit /etc/profile
I am getting following command
(gedit:6758): WARNING **: Command line `dbus-launch --autolaunch=84b871d735f31ffe014dc9ba00000009 --binary-syntax --close-stderr'
exited with non-zero exit status 1:
Autolaunch error: X11 initialization failed.
Cannot open display:
Run 'gedit --help' to see a full list of available command line options.
Or if I am running super-boot-manager I am getting following error
buc: cannot connect to X server
Please help.
super-boot-mangerfrom? – Thor Aug 15 '12 at 09:49super-boot-managerdirectly from unity luncher, it did not worked. Then I have tried it from terminal, then I got those error massage. – Apurba Aug 15 '12 at 13:21echo $DISPLAYsay? You should run it withoutsudoassuper-boot-managerrunssudointernally. – Thor Aug 15 '12 at 15:23echo $DISPLAYis giving:0.0. And I am not runningsuper-boot-managerassudo. I am running just using commandsuper-boot-managerfrom terminal. – Apurba Aug 16 '12 at 19:36DISPLAY=$DISPLAYin commandgeditis not opening usingsudo– Apurba Aug 16 '12 at 19:40bucmight be running as a different user, try removing the X restrictions withxhost +. – Thor Aug 16 '12 at 19:51Defaults env_keep="DISPLAY XAUTHORITY"at the end ofvisudo. Thanks to all, specially @Thor for kind help. – Apurba Aug 17 '12 at 08:03sudoersenv_keep. – Thor Aug 17 '12 at 08:09