ssh not setting XAUTHORITY, XDG_SESSION_COOKIE

Bug #302791 reported by GeorgeDunlap
4
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Description: Ubuntu 8.04.1
Release: 8.04

When logging in to a machine through ssh (without -X or -Y), XAUTHORITY is not set; and when logging in non-interactively, XDG_SESSION_COOKIE is not set. This prevents programs started over an ssh session to connect to the X server of the machine on which it's running.

I use synergy to control my work desktop from my laptop (and so I have more screen real estate). I wrote the following script to automatically run the synergy server and client when I come in to work in the morning:

#!/bin/bash
killall synergys
ssh gdunlap@elijah "killall synergyc"
synergys
ssh -R 24800:localhost:24800 gdunlap@elijah "synergyc -f --name elijah localhost"
ssh gdunlap@elijah "killall synergyc"
killall synergys

It worked until I upgraded this morning, at which point it gave the following error:

DEBUG: CXWindowsScreen.cpp,840: XOpenDisplay(":0.0")
No protocol specified
WARNING: synergyc.cpp,337: cannot open secondary screen: unable to open screen

Digging a little deeper, I found that synergyc was trying to use ~/.Xauthority instead of /tmp/.gdm[...] as it should have, because XAUTHORITY was not being set when logging in over ssh.

Furthermore, I discovered that if I logged in using an interactive shell and set XAUTHORITY manually, then synergyc worked; but if I set XAUTHORITY script-wise in a non-interactive shell, it still didn't work. Further investigation revealed that in the interactive shell, XDG_SESSION_COOKIE is being set, but in a non-interactive shell, it's not being set. If logged in interactively and unset XDG_SESSION_COOKIE, it failed the same way as if I logged in non-interactively.

I'm not sure what the behavior was before, because things "just worked". :-) When I first came in this morning, the script worked, but not after I did a apt-get update. I believe the packages updated were libc, fglrx-control, and some linux modles. libc is the most likely-looking candidate.

GeorgeDunlap (dunlapg)
description: updated
Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

I was wondering if you were still having this problem?

Thanks
chuck

Changed in openssh (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
GeorgeDunlap (dunlapg) wrote :

The XDG_SESSION_COOKIE seems to be set properly now (or at least, it's not causing problems). XAUTHORITY isn't being set, but with only one X server it's easy to set it programmatically with "export XAUTHORITY=/tmp/.gdm*". It's probably best that XAUTHORITY not be set by default, so this issue can probably be closed.

Chuck Short (zulcss)
Changed in openssh (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Tv (tv42) wrote :

You can also do this, to grab stuff from gdm xauth and put it into the xauth file used by ssh. This way e.g. x2x can access both screens.

cat /var/run/gdm/auth-for-"$USER"-*/database | xauth merge -

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.