Date: Wed, 9 Oct 2019 17:07:58 +0100 From: Arthur Chance <freebsd@qeng-ho.org> To: Per Hedeland <per@hedeland.org>, Kostas Oikonomou <k.oikonomou@att.net> Cc: freebsd-questions@freebsd.org Subject: Re: accessing the host's X server from inside chroot Message-ID: <4c51f911-3bc7-7f50-45ba-c6f78af1b5ee@qeng-ho.org> In-Reply-To: <0f7f3a8c-9b5d-c9cf-2bed-9f534216a441@hedeland.org> References: <d5dddadca1e11912e3816ed2f5676931a433cdaa.camel@att.net> <0f7f3a8c-9b5d-c9cf-2bed-9f534216a441@hedeland.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 09/10/2019 14:18, Per Hedeland wrote: > On 2019-10-09 01:45, Kostas Oikonomou wrote: >> I am running FreeBSD 12.0p10. Using chroot, I am trying to run a browser >> (palemoon) located in /opt/devuan, which contains a Devuan Linux >> distribution >> installed with 'debootstrap'. My objective is for the browser to use >> the host's >> (FreeBSD) >> X server, not the Devuan one. >> >> I've added my FreeBSD user name as a Devuan user, home in >> /opt/devuan/home. >> Now I try things like >> >> sudo chroot -u <me> /opt/devuan home/palemoon/palemoon >> >> but I cannot get past the error >> >> Error: cannot open display: :0.0 > > The display name :0.0 corresponds to a unix domain socket, typically > /tmp/.X11-unix/X0, which you of course can't reach after a chroot. By > setting the environment $DISPLAY to localhost:0.0, a TCP connection > should be made instead, but these days the X server doesn't listen for > TCP connections by default. If you start X with startx(1), it should > be possible to pass it '-- -listen tcp' to make the server listen for > TCP connections, see the respective man pages. > > Doing this has some security implications though, since the X server > will then listen on the wildcard address, and it will thus be possible > to connect to it over the network - I didn't see a way to make it > listen only on the localhost/loopback address. Authorization is still > required to actually do anything with the server - unless, of course, > you turn it off with "xhost +". If you run the host X server with -listen tcp and and set the DISPLAY variable in the chroot to localhost:0.0 I think you should be able to connect if you either 1) copy the FreeBSD level home directory's .Xauthority to the chroot's home directory or 2) run "xhost +localhost" at the host level before connecting. -- What do we want? A time machine! When do we want it? Errm ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4c51f911-3bc7-7f50-45ba-c6f78af1b5ee>