2013年9月12日 星期四

Issue Solving -- cannot open display: :0

I remember this error message used to happen on OpenSuSE only. For Ubuntu and Debian users, it's absolutely no problem to use "sudo gparted&" or any other commands that invoke a GUI program with other UID. However in Debian 8(Jessie), this issue occurs:

(gpartedbin:13344): Gtk-WARNING **: cannot open display: :0


I used to try sudo gksu/kdesudo to solve this issue, but still in vain, apparently this doesn't hit the point.

After checking many Debian guru's advices, I believe below is the correct solution to this issue. Please append one line in /etc/sudoers:

Defaults    env_keep+="DISPLAY HOME"
No need to login, your linux can now launch GUI programs with other UIDs.

Ref: Doesn't launch and gives gtk "can't open display"