I just spent a few hours trying to get X11 forwarding over SSH working in one of my jails. I was using the same configuration as the host machine, but there's more to it than that. Here's what needs doing:
pkg install xauth
Add the following line to
With the IP address and hostname you gave the jail. When you ssh in with X11 forwarding, it will try to resolve the machine's hostname. This tells it to use the IP address of the jail.
Make sure these three lines exist in
AllowTcpForwarding yes X11Forwarding yes X11UseLocalhost no
The last line is important because jails don't get their own network stack, so localhost will point to the actual host and not the jail.
Restart SSH with
Now everything should be good to go.