1

Pretty fresh Debian 6.0.3 install, running Gnome 2.30.2. In a root terminal, whenever I try to open anything Gnome related, I'll get this error:

unable to open display ":0.0"

Sometimes this is prefixed by:

No protocol specified

I've added my hostname to xhost, and put xhost +[myhostname] in root's bashrc, but that just fails when I open the root terminal. Help?

EDIT: The only way I can get this to work is by turning off access control entirely, but I know there must be a better solution.

3
  • Are you logging in to X11 itself as root or as a normal user? Nov 11, 2011 at 19:06
  • Well I don't log in to X11 manually, but my Gnome login is a normal user. Does this answer your question? Nov 11, 2011 at 20:15
  • I didn't say "manually"; GNOME login screen is X11 too. Nov 11, 2011 at 20:17

1 Answer 1

1

"No protocol specified" usually means you have been denied access to the X11 display. There are a few ways to do what you want:

  • Point $XAUTHORITY to your Xauthority file. Sometimes it is ~/.Xauthority in your home directory; with GNOME it is a temporary file deep in /var. The following methods will work in both cases:

    • Just copy the environment variable to your root terminal, using echo $XAUTHORITY and export XAUTHORITY=....

    • Make su make a copy of Xauthority by adding pam_xauth to its PAM configuration.

    • Use sudo -s, and configure it to have "XAUTHORITY" in its env_keep option.

    • Use gksu gnome-terminal to launch a root terminal.

  • Add root to the permitted users, by running xhost +si:localuser:root from a normal terminal. This will make Xauthority unnecessary.

Do not add the computer's hostname to xhost, as this is not reliable (rDNS issues), will not work with local connections (only TCP), and is insecure (allows any user to connect to your display).

2
  • Great answer! Thanks for your help! Seems sort of odd that Debian would add an application launcher for a root terminal to the panel by default, but not give the root user privileges for the display. But I guess this is a security feature, and I just abuse the root terminal. Thanks again! Nov 11, 2011 at 20:42
  • It's not really a feature, only lack thereof. (root already can add himself to Xauthority, for example.) Whoever added the launcher probably assumed that administrators are only going to use terminal-based programs (which most sysadmins are). Nov 11, 2011 at 21:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .