View previous topic :: View next topic |
Author |
Message |
elvisd n00b
Joined: 30 Jan 2006 Posts: 17
|
Posted: Tue Feb 14, 2006 7:45 am Post subject: sudo a gui application [solved] |
|
|
Hi all,
i'm trying to launch some GUI application that needs su privileges (i.ex. gdmsetup). I open my shell and type
The application won't start, i have this error:
Code: | (gdmsetup:7865): Gtk-WARNING **: cannot open display: |
In ubuntu that worked fine for every GUi and non-GUi application. Now not. Should i configure something more to have this run?
I have installed gksu and this runs... but I'd like to know why not sudo...
Thank you all
Best regards
elvisd
________
linux_n00b
Last edited by elvisd on Tue Feb 14, 2006 9:57 am; edited 1 time in total |
|
Back to top |
|
|
brims Guru
Joined: 19 Apr 2004 Posts: 492 Location: Arizona
|
|
Back to top |
|
|
elvisd n00b
Joined: 30 Jan 2006 Posts: 17
|
Posted: Tue Feb 14, 2006 7:53 am Post subject: |
|
|
Thax for reply.
I have tried exporting the DISPLAY but gives me the same error. |
|
Back to top |
|
|
yota n00b
Joined: 17 Jul 2005 Posts: 17 Location: Padova (Italy)
|
Posted: Tue Feb 14, 2006 7:59 am Post subject: |
|
|
The user root is not authorized to connect to the x server (that is owned by the user you open the graphic session with).
You can give the permission to root with:
or to erveryone:
|
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
|
Back to top |
|
|
piercey Apprentice
Joined: 28 Jan 2005 Posts: 182
|
Posted: Tue Feb 14, 2006 9:31 am Post subject: |
|
|
or, you could just:
_________________ [ 2008.0 X86 E8400 @ 4.0Ghz ] |
|
Back to top |
|
|
skellr l33t
Joined: 18 Jun 2005 Posts: 975 Location: The Village, Portmeirion
|
Posted: Tue Feb 14, 2006 9:35 am Post subject: |
|
|
I've always used su -c to run GUI apps, untill today.
There are some good examples to put in your sudoers file near the bottom of this page that helps. namely env_keep=DISPLAY
http://www.gentoo.org/doc/en/sudo-guide.xml
Totaly missed noticing env_keep mentioned in the sudoers man page. |
|
Back to top |
|
|
elvisd n00b
Joined: 30 Jan 2006 Posts: 17
|
Posted: Tue Feb 14, 2006 9:57 am Post subject: |
|
|
Thank you. this last reply solved my issue.
I have added a line like this in my /etc/sudoers file:
Code: |
Defaults:elvisd env_keep=DISPLAY
|
Thank you!
Best regards
elvisd
___________
linux_n00b |
|
Back to top |
|
|
lyallp Veteran
Joined: 15 Jul 2004 Posts: 1557 Location: Adelaide/Australia
|
Posted: Wed Aug 01, 2007 11:44 am Post subject: |
|
|
I have successfully kept my DISPLAY by updating /etc/suders such that members of the wheel group keep environment variable DISPLAY only.
ecatmur wrote: | DO NOT use xhost. It's a colossal security hole.
|
Well, given I use xhost +local:root - ie, only root can open windows on my display, I am unsure how this can be a security hole. I fully understand if I just used xhost +
ecatmur wrote: |
You probably need to add pam_xauth.so to /etc/pam.d/sudo:
Code: |
session optional pam_xauth.so
|
|
What does this achieve? Does it make sudo use an X window to prompt for the password?
If so, it's not doing it for me.
Does this line have to be in any place in particular in the /etc/pam.d/sudo file?
I also noticed that the /etc/pam.d/sudo file is auto generated by pamd_mimic_system - so where should I be updating settings so that my mods will stay put? _________________ ...Lyall |
|
Back to top |
|
|
tarpman Veteran
Joined: 04 Nov 2004 Posts: 1083 Location: Victoria, BC, Canada
|
Posted: Wed Aug 01, 2007 3:08 pm Post subject: |
|
|
try gksu or kdesu _________________ Saving the world, one kilobyte at a time. |
|
Back to top |
|
|
xnij2 n00b
Joined: 27 Jun 2006 Posts: 20 Location: Solna, Sweden
|
Posted: Mon Aug 06, 2007 7:55 am Post subject: |
|
|
The sudo env_keep trick worked great! So thanks for that Rainskellr. I've also been doing sudo -c to run gui stuff.
What about the XAUTHORITY environment variable? Should that also be exported? Seems to work without it here tho...
Code: | Defaults env_keep="DISPLAY XAUTHORITY" |
(from http://gentoo-wiki.com/Sudo_config) |
|
Back to top |
|
|
|