How to generate WireGuard QR code on Linux for mobile

You can generate a QR code for a WireGuard configuration on Linux by using the qrencode command. The qrencode command is a command-line utility to generate QR codes.

Here’s an example of how to use the qrencode command to generate a QR code for a WireGuard configuration:

  1. Create a WireGuard configuration file and save it as wg0.conf.
  2. Use the qrencode command to generate a QR code from the configuration file:
qrencode -t ansiutf8 < wg0.conf
  1. Use the qrencode command to generate a QR code and save it as an image file:
qrencode -t png -o wg0.png < wg0.conf
  1. Use the qrencode command to generate a QR code and save it as a PNG image file, and also output it to the terminal:
qrencode -t png -o wg0.png < wg0.conf && cat wg0.png

Once you have the QR code, you can scan it with a mobile device that has a WireGuard client installed, such as the official WireGuard app for Android and iOS.

Please note that qrencode must be installed on your Linux system, and that the above command is for generating QR code for config file, you can also generate QR code for public key, pre-shared key, etc.

It’s always a good idea to check the qrencode website for the latest version and other options.

Leave a Comment