Open bitinerant opened 5 years ago
i am also, has some solution?
Running into the same issue
I'm a bit late to the party, but this issue is not directly related to pywifi. Because by default, root privileges are required to access the control interface of wpa_supplicant.
Also, since pywifi uses the same control interface than wpa_cli
, you can reproduce the error by using this command as a regular user on Ubuntu :
$ wpa_cli status
Failed to connect to non-global ctrl_ifname: (nil) error: Permission denied
To fix the issue, you have to allow non-root users to access the control interface. To do so, edit (or create) the config file of wpa_supplicant and add these options :
(replace 'some_group' by the name of a group which the user belongs. Or the name of the user itself)
#/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=some_group
update_config=1
Then kill wpa_supplicant if it's running and start it with the new options :
(add the option '-B' to run it in the background)
$ sudo wpa_supplicant -D nl80211 -i wlan_interface_name -c /etc/wpa_supplicant/wpa_supplicant.conf
@Oxmel - This is a slow-moving party. :smiley:
You are correct that, on most Linux distributions, root is required, at least temporarily, to manipulate WPA supplicant. In my opinion, this is not an acceptable solution because not all end users have access to root.
Fortunately, there is an alternative, at least for distributions that use Network Manager such as Ubuntu. The nmcli
tool can do (I think) everything that pywifi needs, and it can do it all without root permissions. We just need someone to program the interface between pywifi and nmli
. I actually began this work some months ago, but didn't have time to finish or test. It is still something I am interested in though.
@bitinerant You're completely right, the workaround i given above is rather hackish compared to interfacing with nmcli
, which would be a much better solution.
@Oxmel - This is a slow-moving party. smiley
You are correct that, on most Linux distributions, root is required, at least temporarily, to manipulate WPA supplicant. In my opinion, this is not an acceptable solution because not all end users have access to root.
Fortunately, there is an alternative, at least for distributions that use Network Manager such as Ubuntu. The
nmcli
tool can do (I think) everything that pywifi needs, and it can do it all without root permissions. We just need someone to program the interface between pywifi andnmli
. I actually began this work some months ago, but didn't have time to finish or test. It is still something I am interested in though.
Great! Two and a half years later, any progress?
Solution that worked for. Install python3, pip3 and pywifi on root ( use sudo for all installation if your user is in sudoers file, if you don't understand this just go an google). Then "sudo python3 scirptname.py" and it will work. Main issue is root privileges.