Celeb Glow
news | April 01, 2026

How to connect Raspberry Pi 4 to a hidden WiFi network on Ubuntu Server 20.04?

I have a Raspberry Py 4 with Ubuntu Server 20.04. I want to setup a WiFi connection on it. I have two WiFi networks (2.4 ghz and 5 ghz), both are hidden and have WPA2-Personal setup.

In my /etc/netpaln/50-cloud-init.yaml I have the following config:

network: version: 2 ethernets: eth0: dhcp4: true optional: true wifis: wlan0: optional: true access-points: "MY_HIDEN_SID": password: "MY_PASSWORD" dhcp4: true

Unfortunately, network connection does not work. However, if I setup a mobile hotspot on my phone and change SID and password it connects successfully. So the reason must be in hidden network.

Question: How to connect Raspberry Pi 4 to a hidden WiFi network on Ubuntu Server 20.04?

UPDATE: It turns out there is an option in netplan to specify hidden networks. But it is available only from version 0.100. At the same time, it is not possible to identify which version is included into the 20.20 distribution (it is not the latest one) because netplan developers removed version information from the "netplan info" output.

UPDATE 2 This hack helped solve the issue.

2 Answers

netplan

.yaml files are very fussy with the formatting.

Use this .yaml, and keep the spacing, indentation, and no tabs exactly the same... edit in your SSID and password...

network: version: 2 renderer: networkd ethernets: eth0: dhcp4: true optional: true wifis: wlan0: #hidden: true # only in netplan 0.100 dhcp4: true access-points: "MYREALSSID\"\n scan_ssid=1\n# \"hack!": password: "MY_PASSWORD"

sudo netplan generate

sudo netplay apply

wpasupplicant

Ubuntu Server does not come with wpasupplicant installed, and it's required for wireless to work. We'll install it. A working ethernet connection is required, or a USB flash drive.

sudo apt-get update

sudo apt-get install wpasupplicant

reboot

Update #1:

A hack to get hidden networks to work is here.

8

The correct format of the netplan file for hidden SSIDs on 20.04 is:

network: version: 2 ethernets: eth0: dhcp4: true optional: true wifis: wlan0: optional: true access-points: "MY_HIDEN_SID": password: "MY_PASSWORD" hidden: true dhcp4: true

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy