7

Where does xhost store the allowed network addresses?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Dumb Questioner
  • 2,147
  • 4
  • 20
  • 21

3 Answers3

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

ephemient
  • 198,619
  • 38
  • 280
  • 391
5

I think the addresses are stored inside the xserver.

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

Douglas Leeder
  • 52,368
  • 9
  • 94
  • 137
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.

unwind
  • 391,730
  • 64
  • 469
  • 606