How to run a Gtk application as a user with root privs?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Thank you. I tried the two methods and restarted my computer, I'm still getting this error message: "Gtk-Wraning **: Cannot open display:". Any other idea?
The xhost command I gave won't survive a reboot, you have to issue it new with every session. In theory, HappyTux's method should survive a reboot but you might want to check root's .bashrc to make sure.
Thats odd. Try just issuing xhost localhost on its own and post any output/errors you get back. Also, if you use su to become root in a console, can you then run gnome-ppp? I know that isn't the solution you're after, I'm just trying to get a better handle on where this is going off course.
Hello, "xhost localhost" on its own doesn't report any error message. If I become root using "su -" and then launch "gnome-ppp" it's working fine. But not sudo. Any idea? Thanks.
Hello, "xhost localhost" on its own doesn't report any error message.
It should report something. At least on my rig when I run it I get a "localhost being added to access control list" to tell me that it is doing something.
Quote:
If I become root using "su -" and then launch "gnome-ppp" it's working fine.
Do you still have the xauth entry in your root's .bashrc the way HappyTux suggested? Since the - loads root's environment, that might explain why this works but sudo doesn't.
There are a couple of syntax differences for xhost that also might work. Try these and see if one works for sudo:
Hello, I removed /root/.bashrc, I restarted and I tried again. When I run "xhost localhost" or one of your suggestions, I get: "localhost being added to access control list", but when I run "sudo gnome-ppp", I get the same error message
Hello, I removed /root/.bashrc, I restarted and I tried again.
Removing .bashrc was certainly not needed. All you had to do was comment out the line you added. I also notice you do a lot of restarting. In general Linux doesn't need to do that and in this particular case it may be causing trouble. I know that restarting is the first thing to try in Windows when things don't work, but this isn't Windows.
Quote:
When I run "xhost localhost" or one of your suggestions, I get: "localhost being added to access control list", but when I run "sudo gnome-ppp", I get the same error message
Lets check on something. Try running (as your normal user) echo $DISPLAY. It should return :0.0, but if it doesn't it might be a clue.
Also have a read through this thread, particularly the last couple of posts. They seem to have solved the same problem you're having.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.