You are not logged in.
I run some X11-apps as a different user than the user with which i log on to the desktop (XFCE) so after a reboot I always have to type "xhost +" in a terminal before being able to launch these X11-apps as a different user.
So how can I make "xhost +" the default at every boot?
In which config file do I have to set this to avoid having to type it manually each time?
Last edited by tux_99 (2026-07-11 20:39:50)
“Either the users control the program – or the program controls the users” Richard Stallman
Offline
BTW, I already tried creating /etc/X0.hosts with relevant entries (see below) as indicated in the xhost manpage but that doesn't seem to have any effect.
$ more /etc/X0.hosts
+SI:localuser:username1
+SI:localuser:username2“Either the users control the program – or the program controls the users” Richard Stallman
Offline
Another approach would be to only use 'xhost +' when you want to be the other user and then 'xhost -' when you're done. Put the following script in your path, make it executable and use it like this. I'm calling it 'swu'. You can call it whatever you like.
Open a terminal.
swu <otheruser>
(run some commands as the other user)
exitHere's the magic sauce:
#!/usr/bin/env bash
# swu
otheruser="$1"
xhost +
su "$otheruser"
xhost -
exit 0Offline
Thanks, that could be a feasible workaround but surely there must be a X11 config file that gets read each time X11 is started (i.e. when logging in) in which I could put the xhost command?
“Either the users control the program – or the program controls the users” Richard Stallman
Offline
I sort of solved this by adding the xhost commands I need in the XFCE configuration under "Session and Startup" -> "Application Autostart" as a 'program' to be run on login.
It works fine but I don't consider it an ideal solution as it's DE specific.
Surely there must be a generic DE-independent X11 config file where I could put these 'xhost' commands so that they run on login?
(I did also try .xinitrc in my home directory but that is ignored)
“Either the users control the program – or the program controls the users” Richard Stallman
Offline
man xsession says:
$HOME/.xsession
is a sequence of commands invoking X clients (or a session manager such as xsm(1)). See the manual page
for xinit for tips on writing an .xsession file.This page talks about the security risks of 'xhost +':
https://www.debian.org/doc/manuals/secu … 04.en.html
If you follow the (very bad) suggestion of many docs, you type xhost + on your machine. This allows any X client to connect to your system. For slightly better security, you can use the command xhost +hostname instead to only allow access from specific hosts.
Offline
Thanks fsmithred, while .xsession isn't quite the right file either, by pointing me to it I did some research on it and stumbled upon the correct file:
.xsessionrcAs far as I figured out .xsession replaces the default session startup scripts that are under /etc/X11, while .xsessionrc only complements them, i.e. gets parsed last thing after the /etc/X11 startup scripts, and that's exactly what I was looking for.
I already tested it and it works as expected.
With regards to the security risks, there are none as Devuan (like most Linux distros since many years) starts Xorg with the "-nolisten tcp" parameter, so it's not accessible via the network. Only local users can access it and this is a desktop PC used by a single human user.
Last edited by tux_99 (Yesterday 19:54:04)
“Either the users control the program – or the program controls the users” Richard Stallman
Offline
Or use xhost +localhost to allow connections from the same system only. See man xhost for details (it imples that xhost local would do the same, but I'm not sure if i understood it correctly).
Offline