How do I run gedit as su? - Solaris

This is a discussion on How do I run gedit as su? - Solaris ; When I try try to run gedit from a terminal as su, I get the message Gtk-WARNING **: cannot open display using the command gedit --display=0:0 How do I pass the display number to it properly? Thanks....

+ Reply to Thread
Results 1 to 12 of 12

Thread: How do I run gedit as su?

  1. How do I run gedit as su?

    When I try try to run gedit from a terminal as su, I get the message

    Gtk-WARNING **: cannot open display

    using the command

    gedit --display=0:0

    How do I pass the display number to it properly? Thanks.

  2. Re: How do I run gedit as su?

    On Fri, 20 Jun 2008 20:59:38 -0500, ra wrote:

    > When I try try to run gedit from a terminal as su, I get the message
    >
    > Gtk-WARNING **: cannot open display


    Don't use "s -"; use just "su".


  3. Re: How do I run gedit as su?

    On Fri, 20 Jun 2008 20:59:38 -0500, ra wrote:

    > When I try try to run gedit from a terminal as su, I get the message
    > Gtk-WARNING **: cannot open display


    Maybe because it doesnt exist : /

    > using the command
    > gedit --display=0:0
    > How do I pass the display number to it properly? Thanks.


    You export it or set it or do what Dave suggests if the
    original env is OK... If not ssh to root@localhost instead of
    using su. Requires some trivial setup

  4. Re: How do I run gedit as su?

    ra wrote:
    > When I try try to run gedit from a terminal as su, I get the message
    >
    > Gtk-WARNING **: cannot open display
    >
    > using the command
    >
    > gedit --display=0:0
    >
    > How do I pass the display number to it properly? Thanks.


    You have to enable X-Windows to accept the window.

    i.e. "xhost +" from your login session.

    John

  5. Re: How do I run gedit as su?

    On Sat, 21 Jun 2008 10:10:36 +0100, John Doe wrote:

    > You have to enable X-Windows to accept the window.
    >
    > i.e. "xhost +" from your login session.


    That's a specially valuable technique for allowing *anyone* to run an X
    Windows session on your computer.


  6. Re: How do I run gedit as su?

    Dave Uhring wrote:
    > On Sat, 21 Jun 2008 10:10:36 +0100, John Doe wrote:
    >
    >> You have to enable X-Windows to accept the window.
    >>
    >> i.e. "xhost +" from your login session.

    >
    > That's a specially valuable technique for allowing *anyone* to run an X
    > Windows session on your computer.
    >


    Agreed! Cooperative computing - but then one could read the manual to
    find out how to do it more sensibly, but the 'all' option was more
    likely to work first time which is probably what is required.

    John.

  7. Re: How do I run gedit as su?

    On Sat, 21 Jun 2008 19:19:40 +0100, John Doe wrote:
    > Dave Uhring wrote:
    >> On Sat, 21 Jun 2008 10:10:36 +0100, John Doe wrote:
    >>
    >>> You have to enable X-Windows to accept the window.
    >>>
    >>> i.e. "xhost +" from your login session.

    >>
    >> That's a specially valuable technique for allowing *anyone* to run an X
    >> Windows session on your computer.

    >
    > Agreed! Cooperative computing - but then one could read the manual to
    > find out how to do it more sensibly, but the 'all' option was more
    > likely to work first time which is probably what is required.


    First thing. your assertion that "You have to enable X-Windows to accept
    the window." is all wrong. It is not at all necessary or even desirable.
    The user already owns the X-Window session and with "su", *not* "su -",
    root acquires the user's environment - including access to X Windows.

    What in the world would even make you think that the OP could or would
    have read any particular man page anyway let alone understand it? If the
    OP's workstation is directly connected to the Internet your recommendation
    would have extended your "cooperative computing" to the entire Internet.

    While I really couldn't care less about the effort the OP would have to
    exert to clean up the mess caused by your recommendation I do object to
    having another UNIX machine in some miscreant's botnet.


  8. Re: How do I run gedit as su?

    On Fri, 20 Jun 2008 20:59:38 -0500, ra wrote:
    >When I try try to run gedit from a terminal as su, I get the message


    instead of su, run sux

  9. Re: How do I run gedit as su?

    On Sat, 21 Jun 2008 08:34:12 -0500, Dave Uhring wrote:
    >On Sat, 21 Jun 2008 10:10:36 +0100, John Doe wrote:


    >> You have to enable X-Windows to accept the window.
    >>
    >> i.e. "xhost +" from your login session.


    >That's a specially valuable technique for allowing *anyone* to run an X
    >Windows session on your computer.


    it probably won't work; most desktop environments nowadays run X with
    '--nolisten'

  10. Re: How do I run gedit as su?

    On Sun, 22 Jun 2008 13:05:18 -0500, AZ Nomad wrote:
    > On Sat, 21 Jun 2008 08:34:12 -0500, Dave Uhring wrote:


    >>That's a specially valuable technique for allowing *anyone* to run an X
    >>Windows session on your computer.

    >
    > it probably won't work; most desktop environments nowadays run X with
    > '--nolisten'


    I have no idea about "most" desktop environments, but:

    duhring@maxwell:~$ cat /etc/release
    OpenSolaris 2008.11 snv_91 X86
    .....
    duhring@maxwell:~$ netstat -an | grep LIST
    ....
    *.6000 *.* 0 0 49152 0 LISTEN

    And we *are* discussing OpenSolaris here.


  11. Re: How do I run gedit as su?

    In article , ra wrote:
    >When I try try to run gedit from a terminal as su, I get the message
    >
    >Gtk-WARNING **: cannot open display
    >
    >using the command
    >
    >gedit --display=0:0
    >
    >How do I pass the display number to it properly? Thanks.


    Not only do you have to pass the display, but you should also
    authorize the user to connect to your X server.

    Before you su(1M), run xauth list $DISPLAY.
    After you su(1M), run xauth add.

    John
    groenveld@acm.org

  12. Re: How do I run gedit as su?

    > When I try try to run gedit from a terminal as su, I get the message

    Apart from all the suggestions already given there is another solution which
    I'd personally prefer; thats using the right profile. However, this only works
    on Solaris 10 (and 9 to my knowledge, but I'm not sure).

    First check with the "profiles" command what profiles have been assigned to
    you. By default it will be only limited to "Basic Solaris User" and "All". The
    easiest to allow yourself root privileges is to assign your account to the
    "primary administrator" profile. You can do so using the "usermod" command.
    Something in the likes of 'usermod -P "Primary Administrator" '
    (note; profiles are case sensitive). Once you have done that you may need to
    logout and back in and after that you can basically do anything you want using
    the "pfexec" command ("ProFile exec") to start commands with the privileges
    assigned within the profile. In my example its equal to being root.

    The advantages as single user are simple; easy access to root privileges
    without having to type the root password all the time. And in your example
    without having to do tricks in order to preserve the environment variables. The
    real advantages show themselves in multi user environments IMO; you can
    finegrain access control and even hand people root-like access without having
    to give them the root password.



    --
    ..\\ PGP/GPG key: http://www.catslair.org/pubkey.asc


+ Reply to Thread