Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Setting X11 Display variable

  1. #1
    Join Date
    Jul 2007
    Beans
    239
    Distro
    Kubuntu

    Setting X11 Display variable

    Hi Guys,

    quick question. I have visudo file configured to allow certain applications run via a regular user with sudo powers. The issue I'm having is that I can not seem to get X server to forward properly.

    I think the issue is that since it's a regular user running the application with sudo powers it is sending the X11 to root's X session and not the regular users?

    Has anyone had this issue before?
    AMD X2 3800+ ATI X1600 running 7.10 64bit

  2. #2
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: Setting X11 Display variable

    Did you try gksudo?

  3. #3
    Join Date
    Jul 2007
    Beans
    239
    Distro
    Kubuntu

    Re: Setting X11 Display variable

    Quote Originally Posted by cdenley View Post
    Did you try gksudo?
    Unfortunately I do not have gksudo command, this is a SLES10 box. The equivalent would be sux command for SLES however we do not want to give the user access to the root password but simply allow the user to run certain applications with root power. Hence the use of visudo.
    AMD X2 3800+ ATI X1600 running 7.10 64bit

  4. #4
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: Setting X11 Display variable

    Quote Originally Posted by guilly View Post
    Unfortunately I do not have gksudo command, this is a SLES10 box. The equivalent would be sux command for SLES however we do not want to give the user access to the root password but simply allow the user to run certain applications with root power. Hence the use of visudo.
    Well it doesn't seem to be a problem in ubuntu. What exactly is the error you get?
    Code:
    sudo DISPLAY=:0 myguicommand
    Perhaps posting your sudoers file will help.
    Last edited by cdenley; April 12th, 2010 at 08:06 PM.

  5. #5
    Join Date
    Jul 2007
    Beans
    239
    Distro
    Kubuntu

    Re: Setting X11 Display variable

    I realize it isn't a Ubuntu issue, But I know the Ubuntu community is very well supported compare to other distro's and from what I can tell this is a common issue across distro's.

    This is the error I am getting:

    Exception in thread "main" java.awt.HeadlessException:
    No X11 DISPLAY variable was set, but this program performed an operation which requires it.
    at java.applet.Applet.<init>(Applet.java:75)
    at javax.swing.JApplet.<init>(JApplet.java:131)
    at COM.ibm.storage.adsm.cadmin.clientgui.DDsmApplet.< init>(DDsmApplet.java:416)
    at COM.ibm.storage.adsm.cadmin.clientgui.DDsmApplet.m ain(DDsmApplet.java:806)
    /home/userA
    AMD X2 3800+ ATI X1600 running 7.10 64bit

  6. #6
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: Setting X11 Display variable

    Quote Originally Posted by guilly View Post
    I realize it isn't a Ubuntu issue, But I know the Ubuntu community is very well supported compare to other distro's and from what I can tell this is a common issue across distro's.

    This is the error I am getting:

    Exception in thread "main" java.awt.HeadlessException:
    No X11 DISPLAY variable was set, but this program performed an operation which requires it.
    at java.applet.Applet.<init>(Applet.java:75)
    at javax.swing.JApplet.<init>(JApplet.java:131)
    at COM.ibm.storage.adsm.cadmin.clientgui.DDsmApplet.< init>(DDsmApplet.java:416)
    at COM.ibm.storage.adsm.cadmin.clientgui.DDsmApplet.m ain(DDsmApplet.java:806)
    /home/userA
    And you still get that error when setting the DISPLAY variable like with the command I gave? And once again, your sudoers file might be helpful.
    Code:
    sudo cat /etc/sudoers

  7. #7
    Join Date
    Jul 2007
    Beans
    239
    Distro
    Kubuntu

    Re: Setting X11 Display variable

    Quote Originally Posted by cdenley View Post
    And you still get that error when setting the DISPLAY variable like with the command I gave? And once again, your sudoers file might be helpful.
    Code:
    sudo cat /etc/sudoers
    I apologize I did not see your request for my sudoers file. I seem to have fixed the problem by commenting out Default always_set_home and Defaults env_reset. However, I'm not sure if this causes any risks. Any thoughts?
    Attached Files Attached Files
    AMD X2 3800+ ATI X1600 running 7.10 64bit

  8. #8
    Join Date
    Mar 2010
    Location
    Milan, ITALY
    Beans
    58
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Setting X11 Display variable

    If you nedd to grant access only to local users you can use xhost.

    Code:
    xhost local:root
    Violence is the last refuge of the incompetent

  9. #9
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: Setting X11 Display variable

    Quote Originally Posted by guilly View Post
    I apologize I did not see your request for my sudoers file. I seem to have fixed the problem by commenting out Default always_set_home and Defaults env_reset. However, I'm not sure if this causes any risks. Any thoughts?
    Well the comments in your sudoers file gives specific examples where allowing the user's variables to be used in the sudo session can result in security problems. I think a better solution would be to keep only the variables needed. Try adding this line to your original sudoers file.
    Code:
    Defaults env_keep = "DISPLAY XAUTHORITY XDG_SESSION_COOKIE"

  10. #10
    Join Date
    Jul 2007
    Beans
    239
    Distro
    Kubuntu

    Re: Setting X11 Display variable

    Quote Originally Posted by cdenley View Post
    Well the comments in your sudoers file gives specific examples where allowing the user's variables to be used in the sudo session can result in security problems. I think a better solution would be to keep only the variables needed. Try adding this line to your original sudoers file.
    Code:
    Defaults env_keep = "DISPLAY XAUTHORITY XDG_SESSION_COOKIE"
    That created another issue, now it's complaining about Putty X11 proxy: wrong authentication protocol attempted.

    I've verified that xauth list has the proper cookies set for the root account so they match my regular user
    AMD X2 3800+ ATI X1600 running 7.10 64bit

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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