How to connect to Wi-Fi AP through WPS? All ways will be nice: configs, CLI, GUI - anything.
5 Answers
Tested using Ubuntu 16.04 LTS:
For WPS Push-button mode:
sudo wpa_cli wps_pbc
You can push the WPS button before or after this command, but you have two minutes to have the button pushed and this command ran or you'll have to do it all over again.
For WPS Pin mode:
sudo wpa_cli wps_pin any <the pin>
http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/external/bsd/wpa/dist/wpa_supplicant/README-WPS

- 231
-
Doesn't work for me with Mint 17.3 and TP-Link TL-WR1043ND. Maybe "QSS" not the same as "WPS". – Michael May 10 '16 at 17:26
-
You are correct, QSS is not the same as WPS.... But this question is about WPS, so.... – Brian Foster May 14 '16 at 03:55
-
Doesn't work for me on Xenial.
wpa_cli status
returnswpa_state=COMPLETED
(among other data), but I'm no more connected to the network than I was before. A couple of minutes later, I'm back towpa_state=INACTIVE
as a response. – Jonathan Y. May 16 '17 at 20:04 -
2This worked, however I also had to manually start dhcpcd (
sudo dhcpcd
) and the network icon in my taskbar showed no connection even though I could load webpages. – Shelvacu Sep 02 '17 at 04:59
Solution from ryanjna...@gmail.com http://code.google.com/p/reaver-wps/issues/detail?id=203
Check your interface with this command
sudo wpa_cli wps_pin any
You will get "Selected interface 'your interface' " when you see Your_Interface in the next commands know that you have to replace it with the Interface that you got from this command...
Stop the Network-Manager
Using Upstart
sudo stop network-manager
Using Systemd
sudo systemctl stop NetworkManager.service
Set yourself up a very basic
wpa_supplicant.conf
in/etc/wpa_supplicant.conf
. This command will overwrite any pre-exsiting wpa_supplicant.conf file!:echo -e "ctrl_interface=/var/run/wpa_supplicant\nctrl_interface_group=0\nupdate_config=1" | sudo tee /etc/wpa_supplicant.conf
Start
wpa_supplicant
in daemon mode:sudo wpa_supplicant -B -Dwext -i**your_interface** -c/etc/wpa_supplicant.conf
Run
sudo wpa_cli
. This will start a interactive wpa_cli session.
Verify that it's working by issuing command
status
. You should seewpa_state=INACTIVE
Issue
scan
to scan for existing access-points.Issue
scan_result
after a few seconds to show the results from your scanAdd our BSSID and PIN:
wps_reg xx:xx:xx:xx:xx:xx 12345678
Where
xx:xx:xx:xx:xx:xx
is your BSSID from your scan results. You should see an "OK". Wait a few more seconds aswpa_supplicant
picks up the BSSID and tries to associate and perform key negotiation. What you want to see isCTRL-EVENT-CONNECTED
, which will indicate that the PIN was accepted and that you're now associated.Type the command
save
, which should output another "OK". This will update thewpa_supplicant.conf
file, as specified from the command line, with a static configuration for this new network.Now exit
wpa_cli
by hitting Ctrl D
Run
sudo dhclient **your_interface**
to get IP from the AP (assuming DHCPd were enabled).Verify with
cat /etc/wpa_supplicant.conf
your newly updated config-file.
If all went well, you should have a line under this new network titled psk
.
Good luck!

- 129
-
1Solution doesn't work.
ioctl[SIOCSIWENCODEEXT]: Invalid argument
using Ubuntu 12 LTS. Is there support in NM? – Ura Mar 31 '13 at 22:48 -
@Dejan I got that warning as well in Ubuntu 12 LTS -- solution still worked though. – Robbie Rosati Dec 30 '13 at 19:21
-
@Seth Excuse me, as you know there is no wpa_supplicant.conf in Ubuntu 14.04. Could you please help me? Finally after getting a lots of error, in
sudo wpa_cli status
I gotFailed to connect to non-global ctrl_ifname: (null) error: No such file or directory
error. – Daniyal Javani Dec 04 '15 at 13:15 -
@Daniyal You should ask a new question, comments aren't a good place for third party debugging :) – Seth Dec 04 '15 at 16:14
-
1@Seth Thanks, could you please take a look at http://askubuntu.com/questions/705937/how-to-connect-to-wifi-with-wps-pin-in-ubuntu-14-04 – Daniyal Javani Dec 04 '15 at 16:34
-
-
Isn't there any lesser tedious way? Who is ready to do this every time? – neverMind9 Oct 23 '18 at 17:57
If you don't want to type the password you should click on the WiFi indicator to select the WiFi network. Then, when the enter password screen appears, push the WPS button in the WiFi AP. This will automatically connect you without any password.
This works on my Ubuntu 18.04 and 20.04 machine. This method is official but undocumented.
-
-
1Works in Ubuntu 20.04. It even says you can press the WPS button of the AP in the "Enter network password" window. – Andrei B Nov 29 '20 at 03:04
-
Tested in Ubuntu 18.04 LTS. The password dialog doesn't say a thing about WPS but it worked. Thank you! – rpet Apr 16 '21 at 06:54
I found that I needed instructions from multiple posts above to complete the task as Xubuntu did not have a WPS of any kind that I could find.
Steps 1-3 from https://askubuntu.com/a/170799 .
This one to enable the actual push: https://askubuntu.com/a/769600 .
In this case i used the push button not the pin.And finish with a dhclient.
Linking a script to show how it works with comments. I hope it's ok to do this.
#!/bin/sh
# tadaen sylvermane | jason gibson
# connect to wps capable router via push button. yes we need a gui solution
# but this does it via terminal window. just run the script.
https://askubuntu.com/questions/120367/how-to-connect-to-wi-fi-ap-through-wps
WIFIIF=$(grep wpa /proc/net/unix | cut -d / -f 4)
WPACONF=/etc/wpa_supplicant.conf
steps 1-3 https://askubuntu.com/a/170799
if [ "$USER" = root ] ; then
# stop NetworkManager for this session
systemctl stop NetworkManager
# create wpa supplicant base file
if [ ! -f "$WPACONF" ] ; then
echo "ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1" > "$WPACONF"
fi
# start wpa_supplicant daemon
wpa_supplicant -B -Dwext -i"$WIFIIF" -c "$WPACONF"
# https://askubuntu.com/a/769600
wpa_cli wps_pbc
# go push the button!
echo "push the wps button on the router now!"
read -p "after wps button pushed type yes to connect or no to cancel -> "
yesno
case "$yesno" in
Y|y|yes|Yes|YES)
dhclient
wait
ping -c 1 8.8.8.8 && echo "connected!" && exit 0
;;
*)
# cancel all above changes #
rm "$WPACONF"
kill $(ps aux | grep "$WIFIIF" | grep root | awk '{print $2}')
systemctl start NetworkManager
exit 0
;;
esac
else
echo "must run as root or with sudo"
exit 1
fi
end script

- 1,433

- 21
-
Welcome to Ask Ubuntu! I think is totally ok to link a script, but maybe You could just copy-pase it here? Please use "```" (triple backtick, without quote symbols) at the lines before and after the code to keep a correct formatting, Thank You in advance and for the answer! – kcpr Aug 05 '21 at 23:31
-
1i'll try that. im away from home on my laptop. tried the typical [code] tags bug didn't work. when i get home tomorrow evening ill make a direct post of the script. – user642432 Aug 06 '21 at 02:21
Connect through WPS on a windows setup, where it works out of the box.
Then open up the network settings on that setup, where it allows you to display the network password that was exchanged through WPS.
Copy that password to your ubuntu setup.

- 20,494

- 87
- 1
-
3Don't know why this is being downvoted - it's a practical solution to the main reason this question is useful - that is "I don't know the WIFI password, but I have WPS access, how can I connect?" +1 This also work on android, with a root-mode file explorer, you can check the passwords in
/data/misc/wifi/wpa_supplicant.conf
. – naught101 May 28 '15 at 17:50 -
4Ah, maybe the downvotes were for the comment about ubuntu being frustrating. Here is the relevant bug report - go an subscribe to that, if you want WPS support. – naught101 May 28 '15 at 17:53
-
Thanks for the Android tip, @naught101; worked beautifully from my rooted Nexus 7's terminal! :-) – Tommy Stanton Sep 21 '15 at 12:48
-
1It is being downvoted because we wish to use WPS immediately instead of rebooting twice. – neverMind9 Oct 23 '18 at 17:54
-
@naught101 Do not take this personally, but this really needs to be downvoted. In fact, this is the first downvote I ever placed on AskUbuntu.com. – neverMind9 Oct 23 '18 at 18:13
-
2@neverMind9: No worries. You downvote it because it's not the "correct" way, and I'll upvote it because it works. – naught101 Oct 23 '18 at 22:44
-
-
1@neverMind9 If you wish a working WPS, talk to the Ubuntu team. This site is for finding solutions and this answer is a working solution. – David Balažic Apr 19 '19 at 08:33
wpa_cli
https://forums.linuxmint.com/viewtopic.php?t=192554 – Stavr00 Nov 26 '18 at 14:42