9

How do I check the security mode of the connected Wi-Fi network, using the command-line interface?

I want to know whether the current Wi-Fi connection is protected with WPA, protected with WEP, or is an open network.

2
  • 1
    If this is not your network (and even if it's your, in general), it doesn't matter if the wifi network uses some protection — it should not be trusted anyway… Commented Sep 3, 2015 at 16:03
  • I would have suggested iwconfig, but then realized that on my WPA2 protected network it says Encryption key:off.
    – kasperd
    Commented Sep 3, 2015 at 22:24

4 Answers 4

14

I got it! :)

sudo wpa_cli status

command gives me information exactly that I want.

Selected interface 'wlan0'
bssid=80:1f:72:95:d2:b2
ssid=whatever
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=TKIP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.25.27.111
address=a4:4f:31:15:5f:44
uuid=6099d6ff-4b7d-538a-9e69-3479e250e401

Output of that command is easy to grep.

4

You can try below command from CLI to list SSIDs.

sudo iwlist wlan0 scan 

Or you can also use

nmcli -f all dev wifi | grep SSID | awk '{ print $1 " - " $9 }'

or

nmcli -f all dev wifi | awk '/SSID/{ print $1 " - " $9}'

replace SSID with ssid you need information for.

2
  • 1
    No, this command gives me informations about all wifi networks around. Second command is little more helpful but output of that command is confusing when I'm using it in script.
    – QkiZ
    Commented Sep 3, 2015 at 11:33
  • I added awk part so it will give you only relevant information. Commented Sep 3, 2015 at 11:39
2

Please open a terminal and run:

sudo iwlist wlan0 scan

Your network will appear, along with others in range, similar to this example:

Cell 04 - Address: xx:C1:50:78:B7:xx
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=30/70  Signal level=-80 dBm  
                    Encryption key:on
                    ESSID:"ATT630"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                              24 Mb/s; 36 Mb/s; 54 Mb/s
                    Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s
                    Mode:Master
                    Extra:tsf=00000021823cba79
                    Extra: Last beacon: 4340ms ago
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK

                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK

So we see that the encryption is WPA and WPA2 mixed mode with TKIP.

1
  • 3
    No, this command gives me informations about all wifi networks around. I want only information about connected wifi. Output of searched command will be used in script.
    – QkiZ
    Commented Sep 3, 2015 at 11:30
-3
  • Click on the Wifi Icon on the top right corner.
  • Then click edit connections
  • Select the SSID and click edit
  • Go to security tab.
  • You will the find it there.

thank you

2
  • 5
    Welcome to ask ubuntu, the OP is asking for a way to see this information on the command-line rather than through the GUI.
    – Arronical
    Commented Sep 3, 2015 at 10:44
  • @Arronical Got it !!!
    – leovarmak
    Commented Sep 3, 2015 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .