tags:

views:

200

answers:

3

Where does xhost store the allowed network addresses ?

A: 
$ man xhost | grep -A 2 FILES
FILES
       /etc/X*.hosts

So, I'd take a look in /etc for a file matching that pattern.

The more general lesson here: many commands that use certain files during their operation, will document these files on their manual pages. So, it's a good idea when one wonders something like this, to check the manual. The FILES section is often at the bottom, so a quick "man whatever" followed by ">" (less command to go to the end of the file) will often reveal what you're looking for.

unwind
None of those files exist on my system - but I think xhost would still work.
Douglas Leeder
+1  A: 

I think the addresses are stored inside the xserver.

xhost without any arguments should print out the current allowed list.

Douglas Leeder
+2  A: 

xhost simply calls XAddHost etc., which manipulates a list held by the server. See xhost/xhost.c for the client-side and xserver/os/access.c for the server-side.

You really should try to use xauth instead of xhost if possible. It keeps a list of permissible keys which can be used on a per-user, per-client basis instead of relying on just hostname (spoofable in an unfriendly environment).

ephemient