Share your WiFi info via QR code

Sometimes you just want the security of a long complicated WiFi password without the hassle of having to share it with your guests every time they come over to your house. Well that’s where a conveniently placed QR code comes in!

By embedding your WiFi details in a QR code using a standard that both Android and iOS can understand you can easily give out your WiFi details to guests when they arrive just by having them scan a code somewhere in your house.

The QR code standard that mobile devices understand comes in the following format:

WIFI:S:{SSID name of your network};T:{security type - WPA or WEP};P:{the network password};;

Special characters should be escaped using a “\” character. So for example if your WiFi name was “Tux” and your password was “thelinuxexperiment.com” using WPA encryption you would encode:

WIFI:S:Tux;T:WPA;P:thelinuxexperiment.com;;

OK so now we know the standard but how do we create the QR codes? Well there are plenty of good websites around that will do it for you, but if you’re a little bit weary of putting your WiFi security details into a website you can instead choose to do it offline with a program that does it all on your local machine. For this example I’m going to use qrencode but there are others.

sudo apt install qrencode

Qrencode allows you to create QR code images with a given text. We’ll use the info above as an example:

qrencode -o wifi.png 'WIFI:S:Tux;T:WPA;P:thelinuxexperiment.com;;'

If the resulting QR code is too small you can increase it by also passing the -s flag. The default value is 3 so for example if you passed -s 10 it would make the image substantially larger.

Sample WiFi QR code

Once you have your image you can simply print it off and let your guests scan it when they want access!



4 Comments

  1. Can you get this to work the other way around somehow? So scanning a QR code displayed on a phone to connect a Linux machine to the wifi?

Leave a Reply

Your email address will not be published.


*