Results 1 to 6 of 6

Thread: sudo doesnt open X programs

  1. #1
    epsilon da NNTP User

    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.


    --
    epsilon_da
    ------------------------------------------------------------------------
    epsilon_da's Profile: http://forums.opensuse.org/member.php?userid=19373
    View this thread: http://forums.opensuse.org/showthread.php?t=405624


  2. #2
    Malcolm NNTP User

    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
    epsilon da NNTP User

    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.


    --
    epsilon_da
    ------------------------------------------------------------------------
    epsilon_da's Profile: http://forums.opensuse.org/member.php?userid=19373
    View this thread: http://forums.opensuse.org/showthread.php?t=405624


  4. #4
    hcvv NNTP User

    Default Re: sudo doesnt open X programs


    epsilon_da;1931307 Wrote:
    > 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
    ------------------------------------------------------------------------
    hcvv's Profile: http://forums.opensuse.org/member.php?userid=180
    View this thread: http://forums.opensuse.org/showthread.php?t=405624


  5. #5
    epsilon da NNTP User

    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?


    --
    epsilon_da
    ------------------------------------------------------------------------
    epsilon_da's Profile: http://forums.opensuse.org/member.php?userid=19373
    View this thread: http://forums.opensuse.org/showthread.php?t=405624


  6. #6
    hcvv NNTP User

    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
    ------------------------------------------------------------------------
    hcvv's Profile: http://forums.opensuse.org/member.php?userid=180
    View this thread: http://forums.opensuse.org/showthread.php?t=405624


Posting Permissions

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