How to export display from Linux to FreeBSD

The process is extremely simple all you need to understand is configuration file modification. X Window System use TCP port 6000 to listen network connection. By default almost all operating system including FreeBSD turns off this feature for security reason. Because of this setting you are not allowed to remotely open a window. Let us assume your setup is as follows:


|Linux system        |  FreeBSD system     |
|IP:     |  IP: |

You would like to export display from Linux to FreeBSD.

Step # 1: FreeBSD server startx
To enable this feature, you need to run startx command with the optional -listen_tcp:

$ startx -listen_tcp

Step #2: Allow client system to connect
You need to use xhost command, which is server access control program for X. The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server. For example to allow IP address (our Linux system) you need to type command as follows:

Open X terminal and type command

$ xhost +

Step #3: Export display from Linux to FreeBSD system (type all of the following commands at Linux system)
At your Linux system type following command to export display

$ export DISPLAY=

Step #4: Start program

$ xeyes
$ xterm &
$ mozilla &

All of above three programs are now open on FreeBSD desktop system.
If you have a FreeBSD IPFilter firewall then add following rule to your FreeBSD firewall script:

pass in quick on lnc0 proto tcp from to port = 6000 flags S keep state

Above rule will allow TCP Port 6000 connection from Linux system to FreeBSD system. Make sure you replace lnc0 interface and IP address with your actual interface and IP address. Just restart IPFilter as follows:

# /etc/rc.d/ipfilter restart

Please note that above procedure is same even if you use OpeBSD or or any other Linux distro.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.