Automatically adding local user to xhost list?

On Ubuntu, the local user is automatically added the xhost list when logging in (via a script in /etc/X11/Xsession.d).

Is there a way to enable this in OpenSUSE?

(My original problem is that I cannot interact with a running X session when loggin in via SSH, since newer GDM versions don’t create $HOME/.Xauthority any longer.)

You can still create $HOME/.Xauthority and use that.

I’m not quite sure what you are doing. I assume that you are trying to export your xauth cookie over an ssh channel, then setting DISPLAY, but X still does not work. Try also setting $XAUTHLOCALHOSTNAME in the environment of the user you are logging in as. That was the change that I found was needed to get it working.

If you’re logging in through ssh, we’re not talking about ‘local’ user. You can add other computers to /etc/X0.hosts (create this file if needed) and/or issue xhost + <your ssh client> on the server, then export DISPLAY on the client … if that’s what you are trying to do.

SSH has Xforwarding built in ether via the ~/.SSH/config or simply using SSH -x or ssh -X (I forget the case). Don’t set the DISPLAY variable, it will be already set correctly. System wide config is done in /etc/SSH/SSH.conf
Xhosts method was used for telnet an rsh which are very insecure.

If security matters than you would use trusted X11 forwarding with -Y (not -X).

@please_try_again, dwellen:
That is not what I’m trying to do… I’m trying to connect to an X session running on the SSH host, ie:

ssh username@host
...
DISPLAY=:0 xterm

I guess I’ll write a script then that I’ll run once per machine, which finds the GDM cookie and copies it to $HOME/.Xauthority… beats running “DISPLAY=:0 xhost +SI:localuser:username” as root every time I log in :wink:

Still, I’d prefer a solution that is agnostic to the particular session type used on the machines…

Why don’t you try to run an NX (No Machine or FreeNX) server on your SSH host? … or you can remote login with xdm (using X -query) . I read somewhere that XDMCP support had been removed from GDM. But NX is a lot better (safer, faster) than XDMCP.

  • Maybe that’s the problem: Ubuntu might have reimplemented XDMCP in GDM … while openSUSE did not (?)

Turns out I also need to do this, setting XAUTHORITY (or copying the cookie) alone does not do the trick!

This is rather annoying… :-/

Setting the DISPLAY variable before logging it to a remote system won’t do anything.

Use SSH -x (remote system name) term

This will start term on the remote system but display it on the local screen. Heather the DISPLAY or xhosts is used. Display variable is set to the tunnelsetup by SSH.

Looking at it again it seams you want to attach to the remote systems display? This is called root
window access which requires nx or vnc. Normally it’s not configured.

I was wrong (wasn’t sure either). I’m just testing gdm remote logins (through Xnest and Xephyr --query) on openSUSE 11.4 server. It does have XDMCP. Of course it needs to be manually added in /etc/gdm/custom.conf, but XDMCP is implemented (unlike in several gdm versions. I don’t know which ones but I’m sure there are some).