Question

Where does xhost store the allowed network addresses?

Was it helpful?

Solution

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

OTHER TIPS

I think the addresses are stored inside the xserver.

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top