Running X apps with sudo (gparted, …).

17 May

By default running X applications with sudo doesn’t work in Ubuntu, the result will look something like this:

$ sudo gparted
 
(gpartedbin:15568): Gtk-WARNING **: cannot open display:



To allow the sudo child process to connect back to the caller’s X server, add this to your /etc/sudoers:

Defaults        env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"