Page 1 of 5 123 ... LastLast
Results 1 to 10 of 41

Thread: sudo doesnt open X programs

  1. #1

    Default sudo doesnt open X programs

    Hi.

    I am using OpenSuse 11.1 and i cant find a way to make sudo open X programs like gedit

    Code:
    diego@linux-8mmd:~> sudo gedit
    No protocol specified
    
    (gedit:5500): Gtk-WARNING **: cannot open display: :0.0
    
    diego@linux-8mmd:~> sudo xhost +localhost
    xhost:  unable to open display ""
    gnomesu works, but it asks for password.

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,516
    Blog Entries
    15

    Default Re: sudo doesnt open X programs

    Quote Originally Posted by epsilon da
    Hi.

    I am using OpenSuse 11.1 and i cant find a way to make sudo open X
    programs like gedit


    Code:
    --------------------
    diego@linux-8mmd:~> sudo gedit
    No protocol specified

    (gedit:5500): Gtk-WARNING **: cannot open display: :0.0

    diego@linux-8mmd:~> sudo xhost +localhost
    xhost: unable to open display ""

    --------------------


    gnomesu works, but it asks for password.
    Hi
    Use xdg-su, for example;
    Code:
    xdg-su -c "gedit /etc/hosts"
    --
    Cheers Malcolm (Linux Counter #276890)
    openSUSE 11.1 x86 Kernel 2.6.27.7-9-default
    up 3 days 9:58, 3 users, load average: 0.30, 0.21, 0.24
    GPU GeForce 6600 TE/6200 TE - Driver Version: 180.22


  3. #3

    Default Re: sudo doesnt open X programs

    thanks, better than gnomesu, but still asking for password, and is more complicated to type in the console.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,865

    Default Re: sudo doesnt open X programs

    Quote Originally Posted by epsilon_da View Post
    Hi.

    I am using OpenSuse 11.1 and i cant find a way to make sudo open X programs like gedit

    Code:
    diego@linux-8mmd:~> sudo gedit
    No protocol specified
    
    (gedit:5500): Gtk-WARNING **: cannot open display: :0.0
    
    diego@linux-8mmd:~> sudo xhost +localhost
    xhost:  unable to open display ""
    gnomesu works, but it asks for password.
    You force the same error twice. sudo lets a process run as root and is not allowed to open a window on the display you diego have.
    Then you use sudo again running xhost as root. But root can not help you here, it has no display. diego must run xhost. So leave out the sudo:
    Code:
    diego@linux-8mmd:~> xhost +
    Now you, diego, allow everybody (including root) to open a window on your display.
    Henk van Velden

  5. #5

    Default Re: sudo doesnt open X programs

    Thank you.

    Very good explanation.

    I just did "xhost +" as user "diego" and now sudo is able to run X programs.

    Now just to ask... is there a way to only allow sudo in the xhost's list?

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,865

    Default Re: sudo doesnt open X programs

    It is not the command sudo, but the user root you have to allow. And indeed, a plain xhost + does allow "anybody" to open windows before your very nose . Now do not be to afraid of this, Those from other systems are normaly blocked from doing so by your firewall. And those from inside your system ... well, when this is a pc there will not be very many.

    But yes you can restrict. Your +localhost is restricting it to those comming from localhost (127.0.0.1), that is "inside".

    You could read the man xhost page (as I did). It talks about usernames, but I can not find out how . But as said, localhost may be enough security.

    BTW I think (but not quite sure, please test) that once a + entry is added to the list, it stayes there over the following log-ins (somewhere in a .X* or .x* file in your home directory). Just a
    Code:
    xhost
    will tel you what the situation is. Eventualy first do a
    Code:
    xhost -
    before a more restricting
    Code:
    xhost +localhost
    Henk van Velden

  7. #7

    Default Re: sudo doesnt open X programs

    Hi Friends,
    I too need to run gui application from normal user account but with root privileges.
    I tried xhost + and then sudo gui_app.sh ( I have already added relevant entry in /etc/sudores file )
    but it give Error: Can't open display:

    (echo $DISPLAY gives localhost:11.0)

    Any guide to fix this issue.

  8. #8

    Default AW: Re: sudo doesnt open X programs

    Quote Originally Posted by dhananjaya_amarakoon View Post
    Hi Friends,
    I too need to run gui application from normal user account but with root privileges.
    I tried xhost + and then sudo gui_app.sh ( I have already added relevant entry in /etc/sudores file )
    but it give Error: Can't open display:

    (echo $DISPLAY gives localhost:11.0)

    Any guide to fix this issue.
    You can't and shouldn't run gui applications with sudo.
    Use kdesu, gnomesu or xdg-su instead.

    F.e.:
    Code:
    xdg-su -c program
    kdesu program
    gnomesu program

  9. #9
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,043

    Default Re: sudo doesnt open X programs

    On Tue, 28 May 2013 18:16:03 +0000, dhananjaya amarakoon wrote:

    > Hi Friends,
    > I too need to run gui application from normal user account but with root
    > privileges.
    > I tried xhost + and then sudo gui_app.sh ( I have already added
    > relevant entry in /etc/sudores file )
    > but it give Error: Can't open display:
    >
    > (echo $DISPLAY gives localhost:11.0)
    >
    > Any guide to fix this issue.


    Use gnomesu or kdesu instead of sudo.

    Jim



    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  10. #10

    Default Re: sudo doesnt open X programs

    HI wolfi323
    thanks for the support. but it request root password
    but my requirement is open a gui application ( with root permission ) from normal user without given root password. is there any possibility of getting this done.

    Dhananjaya

Page 1 of 5 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •