diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2022-04-08 18:50:41 +0200 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2022-04-08 18:50:41 +0200 |
commit | 25547303a15d699749b382cf4f33ee744820a431 (patch) | |
tree | 5fb2f1aff2533a72c191ed2c2d87f5eee4ea605b /20220408-remote-desktop-vnc-openbsd.md | |
parent | b5e822aaf1ba61134c05dc38506c4a4031d7c9c1 (diff) |
article: x11vnc on openbsd
Diffstat (limited to '20220408-remote-desktop-vnc-openbsd.md')
-rw-r--r-- | 20220408-remote-desktop-vnc-openbsd.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/20220408-remote-desktop-vnc-openbsd.md b/20220408-remote-desktop-vnc-openbsd.md new file mode 100644 index 0000000..65cd2db --- /dev/null +++ b/20220408-remote-desktop-vnc-openbsd.md @@ -0,0 +1,29 @@ +# Remote X11 desktop with x11vnc on OpenBSD + +April 8, 2022 + +Here are a few quick instructions on how to setup a VNC server on OpenBSD. This can give you remote X11 access to your OpenBSD machine if you can run an SSH client and VNC client. + +If you selected the default sets during your OpenBSD install, the X11 server is already installed, if not, you should install it now. We'll just need to install a VNC server through the packages, I've settled on `x11vnc`: + + # pkg_add x11vnc + +Setting up `x11vnc` is pretty simple, you just need to give it command line options when starting the daemon. This is very simple with OpenBSD, just add your options to the `/etc/rc.conf.local` file. Here is an example configuration: + + x11vnc_flags="-listen localhost -rfbauth /etc/x11vnc.passwd -logfile /var/log/x11vnc -ncache 0 -display :0 -forever -loop100 -auth /etc/X11/xenodm/authdir/authfiles/A:0-*" + +I won't explain all the options here, you should read `x11vnc(1)` and/or the [doc](https://github.com/LibVNC/x11vnc/tree/master/doc/OPTIONS.md) for more details. Nonetheless, the first two options are worth explaining. The VNC server is listening on localhost because the VNC protocol is not encrypted by default, so we will tunnel the VNC connection through SSH. Next, we specify a file containing the password to allow connecting. This file can be created with the following command, of course you should not use `verysecurepassword`: + + # x11vnc -storepasswd verysecurepassword /etc/x11vnc.passwd + +According to the man page, this file is not encrypted and just obfuscated with a fixed private key, so you should restrict the permissions on this file. Anyway the server is ready to be started: + + # rcctl start x11vnc + +You should now be able to connect to the server, after setting up the port forwarding with SSH, as such for example: + + $ ssh -L 5900:localhost:5900 myserver + +This basically forwards port 5900 of `myserver` to port 5900 on `localhost`. To connect to the VNC server, simply use `localhost` as the server and port 5900. If issues may arise, read the log and `x11vnc(1)`. I've been using this setup for a few weeks now and I'm quite happy with it. As a bonus, here is a screenshot of my openbox VNC session: + +[![openbox session screenshot](/static/20220408-openbox-vnc.png)](/static/20220408-openbox-vnc.png) |