Everywhere across the Internet you’ll find “answers” to this question that tell you to do gksudo and kdesu and if you’re like me you get by by working around your problem in some way that lets you gksudo or kdesu – until that one time when it just doesn’t cut no matter which way you slice it. That time is now for me, and what a surprise, it’s a damn pain in the neck to actually dig out a solution from amidst the mountain of “use gksudo/kdesu”s.
So here’s me penning this post to hopefully help combat the million other gksudo/kdesu posts out there – because sometimes, you need stuff run – graphically and as root – when you’re not around to type a password.
Solution is surprisingly simple. Your X display is normally loyal only to you (the user) and will not answer to any other user, not even root. If you tried to run a graphical application from a rooted terminal, it’ll say something like the following:
X11 error: Can’t open display :0
Which is your application’s plaintive cry at being shut out by X. So to get around this, you basically just need to tell X to stop doing that. Like so:
xhost +
Run it as your regular user (X normally ignores everyone else remember?). And that’s it! Try it. Open a terminal, su, and open firefox or something.
PS: yes I’m not dead yet, and yes I still haven’t finish that blasted Eva post I’ve been sitting on for ages ;_;
Ancurio
Hmm, that’s weird, I was never hindered by X11 from running apps as root.. I’m on Fedora though, maybe that’s why
Jason "moofang"
Yeah I think some distros allow it. I remember being on ubuntu and I can just sudo somegraphicalapp.