Where does xhost store the allowed network addresses?
Asked Answered
T

3

7

Where does xhost store the allowed network addresses?

Tee answered 27/3, 2009 at 9:30 Comment(0)
L
6

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).

Liquefacient answered 27/3, 2009 at 18:7 Comment(0)
S
5

I think the addresses are stored inside the xserver.

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

Saraann answered 27/3, 2009 at 9:55 Comment(2)
It does not print out a list of authorized hostnames on my Mac Big Sur,Laboy
Yes, it prints the list. But where does it store it? Memory only, no files?Mildredmildrid
C
0
$ 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.

Commie answered 27/3, 2009 at 9:34 Comment(2)
None of those files exist on my system - but I think xhost would still work.Saraann
I got the message "non-network local connections being added to access control list" but there is no /etc/X*.hosts. Therefore I conclude the mystery remains.Mildredmildrid

© 2022 - 2024 — McMap. All rights reserved.