Results 1 to 6 of 6

Thread: root cannot open display

  1. #1
    Join Date
    Feb 2011
    Beans
    80

    root cannot open display

    Using expect under gnome i login as root:

    expect -c 'spawn su - ;expect senord:;send "assword";interact'

    but opening a GUI-application doesn't work:


    spawn su -
    Lösenord:
    root@x22:~# nautilus


    (org.gnome.Nautilus:50916): Gtk-WARNING **: 13:56:46.709: cannot open display:
    root@x22:~#

    Doing the same using su insted of expect works OK.
    Why is this so?
    My system is Ubuntu 22.04 on an Intel i7.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: root cannot open display

    Nope. Root can't use a GUI login. Nothing to see here. Move along. This should not work.

  3. #3
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: root cannot open display

    In Ubuntu, the 'root' user does not have right to use a GUI. It is felt as a security risk.

    The root account is disabled by default, GDM is by default set to AllowRoot=false, and PAM is set to not allow root to log into GDM...

    So yes, there are many things set up to not allow a root user access to a GUI Desktop or GUI App's. It can be done, but is felt to be like running with scissors.

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

  4. #4
    Join Date
    Feb 2011
    Beans
    80

    Re: root cannot open display

    I have AllowRoot=yes and I can log in to gnome with my root account so this shouldn't' be the problem.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: root cannot open display

    Quote Originally Posted by hakelm View Post
    I have AllowRoot=yes and I can log in to gnome with my root account so this shouldn't' be the problem.
    I thought X/Windows had built-in code to prevent running from a root session. Could be wrong. Might just be a PAM setting in /etc/pam.d/

  6. #6
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: root cannot open display

    Also the setting in the GDM conf file... <--- Becaseu that has a setting there locking root out also. Then after all that, you would have to generate an .Xauthority file for the root user...

    Just remembering that: "Just because something is possible, doesn't make it a good idea."

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

Tags for this Thread

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
  •