question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working on Ubuntu 18.04 as normal user

See original GitHub issue
$ lsb_release -d
Description:	Ubuntu 18.04.2 LTS
$ python3 example.py  # this is the code from README.md
Traceback (most recent call last):
  File "example.py", line 7, in <module>
    iface = wifi.interfaces()[0]
  File "/home/cor/.local/lib/python3.6/site-packages/pywifi/wifi.py", line 42, in interfaces
    for interface in wifi_ctrl.interfaces():
  File "/home/cor/.local/lib/python3.6/site-packages/pywifi/_wifiutil_linux.py", line 281, in interfaces
    for f in sorted(os.listdir(CTRL_IFACE_DIR)):
PermissionError: [Errno 13] Permission denied: '/var/run/wpa_supplicant'
$ sudo chmod 755 /var/run/wpa_supplicant
$ python3 example.py
Traceback (most recent call last):
  File "example.py", line 7, in <module>
    iface = wifi.interfaces()[0]
  File "/home/cor/.local/lib/python3.6/site-packages/pywifi/wifi.py", line 42, in interfaces
    for interface in wifi_ctrl.interfaces():
  File "/home/cor/.local/lib/python3.6/site-packages/pywifi/_wifiutil_linux.py", line 288, in interfaces
    self._connect_to_wpa_s(f)
  File "/home/cor/.local/lib/python3.6/site-packages/pywifi/_wifiutil_linux.py", line 304, in _connect_to_wpa_s
    sock.connect(ctrl_iface)
PermissionError: [Errno 13] Permission denied
$ 

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
bitinerantcommented, Oct 17, 2019

@Oxmel - This is a slow-moving party. 😃

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.

2reactions
Oxmelcommented, Oct 17, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ubuntu 18.04 on login loop, even with correct password
Login loop issues, type Ctrl+Alt+F3, at terminal login, if your password is correct, all is well, then at prompt type startx, ...
Read more >
Black Screen Or Login Issues (Ubuntu) - System76 Support
If your username and password are both correct, then something else is blocking the login. This is a difficult issue to troubleshoot, and...
Read more >
How To Create a New Sudo-enabled User on Ubuntu 18.04 ...
To test that the new sudo permissions are working, first use the su command to switch to the new user account: su -...
Read more >
Ubuntu 18.04LTS full - chaos! a lot of customization problem ...
everything is good initially, but one time it started to freeze when i use ubuntu generally.. just internet and normal ...
Read more >
ubuntu does no let me log in to my user, how can I fix it?
Press Ctrl + Alt + F3 and login into the shell using your username and your password. In this case username will be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found