Ubuntu – “cannot open display: :0” error when using sudo with any GTK app

gtksudo

I want to run gmsartcontrol (UI tool for smartctl) which needs to be run as root in order to access the drives and read their SMART status.

However doing this:

sudo gmsartcontrol

I get this error:

No protocol specified
[gtk] cannot open display: :0

Best Answer

For graphical applications use gksu:

gksu gsmartcontrol

If it is not installed on your system you can get it via:

apt-get install gksu