Using xhost with Ubuntu

Ubuntu (and many distributions these days) come with xhost very much turned off. If you install the xhost package, it doesn't work, and it's not easy to find out why. This is because, evidently, running xhost is a very security dangerous and naughty thing to do. The general recommendation is to use ssh with port forwarding (-X). If you're naughty, however, as am I, and you really want to use xhost, then you need to do the following (all as root):
  1. Edit /etc/X11/xinit/xserverrc:
    Remove the "-nolisten tcp"
  2. Edit /etc/gdm/gdm.conf:
    Comment out the "DisallowTCP=true" so that it doesn't add the -nolisten back.
  3. Really restart X
    The easiest way is to probably kill gdm and then restart it from a text login:
    /etc/init.d/gdm stop
    At a text login:
    /etc/init.d/gdm start

Back to Solutions.

DaveSource.com - Dave's geek site GetDave.com - all the current Dave Pointers. MarginalHacks - I have an elegant script for that, but it's too small to fit in the margin.