6

I would like to get a list of all the wireless networks.

iwlist wlan0 scan | grep ESSID

This will only show me the wireless network I am currently connected to. When I run the command as root, it shows me all the available networks. If I run the command without sudo quickly after this, all the networks will show up, but after a while they are all gone except the network I am currently connected to.

Is there a way to get all the available networks when I am not root?

1 Answer 1

5

You could (or do?) probably use wpa_supplicant; using its ctrl_interface configuration key, you can allow non-root users (e.g. those with group wheel) access via wpa_cli (i.e. /sbin/wpa_cli scan_results [1])

# allow frontend (e.g., wpa_cli) to be used by all users in 'wheel' group
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

There's also a command-line switch to wpa_suppliant,

-u     Enabled  DBus  control  interface. If enabled, interface defini‐
       tions may be omitted.

giving you a DBus interface and thus another possibility for non-root access (I think NetworkManager uses this interface).

[1] Once connected, this only shows the wireless LAN you are connected to...I don't know if this is any different with NetworkManager.

2
  • 1
    Thank you for your answer. Adding "GROUP=wheel" and calling wpa_cli scan and wpa_cli scan_results do the trick for me. Do you know if the same change (allowing the wheel group to execute) is possible with iwlist? Commented Aug 14, 2012 at 11:56
  • No idea, sorry. Commented Aug 14, 2012 at 12:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.