When I run sudo gedit /path/to/some/random/file
I get the following error
** (gedit:6262): WARNING **: Command line `dbus-launch --autolaunch=7f8731869e1c690b8205727e0000000a --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.
Using gksudo
doesn't help either which returns
Cannot open display:
Run 'gedit --help' to see a full list of available command line options.
Any help guys. I need to have this capability to open files in Gedit as root.
I found this question with the same error but no solution Unable to launch gedit with sudo
EDIT
I found this post in Ubuntu Forums.
These are the instructions:
- echo $DISPLAY # you'll be needing this value 3 lines below
- sudo -i # or "su -" on older Slackwares
- xauth merge ~alien/.Xauthority # use your own username here instead of "alien"
- export DISPLAY=:0.0 # use the value of DISPLAY you've seen 3 lines before
On coming to command #3, I got this error
xauth: file /root/.Xauthority does not exist
Maybe this new info can shed more light.