Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Do you know a way to do it permanently so I just have to run it at install ? Commented Sep 16, 2018 at 16:24
  • I'm not sure what you mean. Just create a shell script file with a name like 35-add-root-xhost in the appropriate directory, with the new extra xhost command in it, and make sure it is executable. It will be run at each login. Commented Sep 16, 2018 at 17:58
  • My issue is that I will deploy the app on several linux systems using an install script so I'm looking for a way to allow root to connect X (with xhost +si:localuser:root for example) but permanently with one command ran at install. The script would be nice if the location were always the same on the system. Commented Sep 16, 2018 at 20:15
  • @Arkaik Did you find a clean way to "install" this configuration? What did you try next? I'm stuck in the same place you were... Commented Apr 24, 2024 at 10:17
  • 1
    It's been a very long time since I worked on this project, so I don't really remember everything I did. However I got it to work with different configurations depending on the targeted OS, on my development computer I used ExecStartPre=/usr/bin/xhost +si:localuser:root into the systemd unit file and ran the service as root. On the Pi I ran the service as a specific user/group appuser that was created during the image preparing into a loop device and I used Environment="DISPLAY=:0" and Environment="XAUTHORITY=/home/appuser/.Xauthority" into the unit file. Hope it helps you. Commented Apr 25, 2024 at 15:39