Annoying policy prevents wifi scan

 Just in case you're having problem with this error message everytime you connect to your Ubuntu via xrdp:



Dia browser comment this:

"This is a PolicyKit (polkit) authentication prompt on Ubuntu asking for permission to perform Wi-Fi scans. It’s a common annoyance on Ubuntu desktop, especially when connecting via remote desktop (like RDP from a Windows app on macOS to your Ubuntu machine)."

NetworkManager always tries to scan the Wi-Fi when I'm logging in remotely. Remote sessions are treated non-local, so polkit asks for your password every time.

The fix is straightforward. Create a polkit rule to allow the scan without authentication. 

1. Create this file: /etc/polkit-1/localauthority/50-local.d/allow-wifi-scan.pkla

2. This the content for the file:

[Allow Wi-Fi Scan]

Identity=unix-user:*

Action=org.freedesktop.NetworkManager.wifi.scan

ResultAny=yes

ResultInactive=yes

ResultActive=yes


3. That's it. Now restart polkit:

sudo systemctl restart polkit



Comments