[systemd-devel] xmodmap gives: No protocol specified

Mantas Mikulėnas grawity at gmail.com
Fri Nov 4 12:29:20 UTC 2016


On Fri, Nov 4, 2016 at 1:47 PM, Cecil Westerhof <cldwesterhof at gmail.com>
wrote:

> I have a script I want to run as a service which uses:
>     xmodmap -pk
> I have to define the DISPLAY, so I use:
>     export DISPLAY=:0.0
>
> But this gives:
>     export DISPLAY=:0.0
>     xmodmap:  unable to open display ':0.0'
>
> When I try the same with at, I do not have this problem.
>
> What is happening here and how can I resolve this?
>

What's happening is that you shouldn't run X11 programs as system services.

Most of the time, Xlib saying "No protocol specified" means that the X
server rejected the connection attempt due to missing authentication
details. To fix that, either the program needs the path to your Xauthority
file, or the X server needs to be configured to allow all connections by
your UID.

The default location of Xauth information is ~/.Xauthority – if your
program cannot find it, either you need to set $HOME, or your display
manager (gdm &c.) probably stored it elsewhere and you need to set
$XAUTHORITY. Either way, don't run X11 programs as system services.

Allowing connections by UID might be simpler – run `xauth
+SI:localuser:$(id -un)` in your X11 startup script. (The full SI:* syntax
is described in Xsecurity(7).)

-- 
Mantas Mikulėnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20161104/4d758168/attachment.html>


More information about the systemd-devel mailing list