"No protocol specified" when starting X programs from a script

Tino Keitel tino.keitel+xorg at tikei.de
Fri Apr 29 00:45:14 PDT 2011


On Thu, Apr 28, 2011 at 11:11:23 -0700, Alan Coopersmith wrote:
> On 04/28/11 12:27 AM, Tino Keitel wrote:
> > Hi,
> > 
> > I try to start an X application from a script, which is not called from
> > X. This works with the Xfce desktop, but does not with Gnome3.
> > 
> > The script sets DISPLAY=:0 and HOME to the user that owns the X
> > session. The application is started with user and group permissions for
> > the user that owns the X session.
> > 
> > Here is the strace output that causes the error:
> > 
> > socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
> > connect(3, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"}, 20) = 0
> > getpeername(3, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"}, [20]) =
> > 0
> > uname({sys="Linux", node="mac", ...})   = 0
> > access("/home/scorpion/.Xauthority", R_OK) = 0
> > open("/home/scorpion/.Xauthority", O_RDONLY) = 4
> > 
> > Any hints what I'm doing wrong?
> 
> You're using GNOME 3, specifically the new gdm, which doesn't put the xauth
> cookie into $HOME/.Xauthority, so that programs outside your session can't
> connect to it.
> 
> You could run 'xhost +si:localuser:scorpion' in your gnome session, so that
> the xauth cookie isn't required for local connections from your uid.

Thanks Julien and Alan. I decieded to use the most current xauth
database for the user currently logged in (`ls -d --sort=time
/var/run/gdm3/auth-for-$XUSER-* | head -n 1`/database) for XAUTHORITY,
which works fine.

Regards,
Tino



More information about the xorg mailing list