31

How to connect to Wi-Fi AP through WPS? All ways will be nice: configs, CLI, GUI - anything.

7
  • This question appears to be abandoned. Unaccepted answer or unanswered, could you perhaps add more detail to your question? If this question no longer applies then you can either delete it or answer it yourself if you've solved the problem. Flagged for deletion. Thanks! – Ringtail Jan 13 '13 at 3:07
  • I have no possibility to try solution for any time, but it seems good. – Michael Jan 13 '13 at 7:07
  • @user51072 Did you try it? do you have a working solution? – Dejan Mar 31 '13 at 22:52
  • 1
    Its very good question but very complex answers :/ what is really interesting that on onther platforms its one click functionality... We might probably wait till there is better more stable way before accepting answer.. – Jurosh Oct 13 '18 at 18:42
  • 1
    An older answer for LinuxMint, with a detailed walkthrough of wpa_cli forums.linuxmint.com/viewtopic.php?t=192554 – Stavr00 Nov 26 '18 at 14:42
12

Solution from ryanjna...@gmail.com http://code.google.com/p/reaver-wps/issues/detail?id=203

  1. Stop the Network-Manager

    Using Upstart

    sudo stop network-manager
    

    Using Systemd

    sudo systemctl stop NetworkManager.service
    
  2. 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
    
  3. Start wpa_supplicant in daemon mode:

    sudo wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
    
  4. Run sudo wpa_cli. This will start a interactive wpa_cli session.

    • Verify that it's working by issuing command status. You should see wpa_state=INACTIVE
    • Issue scan to scan for existing access-points.
    • Issue scan_result after a few seconds to show the results from your scan
    • Add 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 as wpa_supplicant picks up the BSSID and tries to associate and perform key negotiation. What you want to see is CTRL-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 the wpa_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
  5. Run sudo dhclient wlan0 to get IP from the AP (assuming DHCPd were enabled).

  6. 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!

7
  • 1
    Solution doesn't work. ioctl[SIOCSIWENCODEEXT]: Invalid argument using Ubuntu 12 LTS. Is there support in NM? – Dejan 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 got Failed to connect to non-global ctrl_ifname: (null) error: No such file or directory error. – Daniyal Javani Dec 4 '15 at 13:15
  • @Daniyal You should ask a new question, comments aren't a good place for third party debugging :) – Seth Dec 4 '15 at 16:14
  • 1
    @Seth Thanks, could you please take a look at askubuntu.com/questions/705937/… – Daniyal Javani Dec 4 '15 at 16:34
10

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

4
  • 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 3:55
  • Doesn't work for me on Xenial. wpa_cli status returns wpa_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 to wpa_state=INACTIVE as a response. – Jonathan Y. May 16 '17 at 20:04
  • 2
    This 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 2 '17 at 4:59
3

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.

8
  • 3
    Don'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
  • 3
    Ah, 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
  • 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 8:33
1

if you don't want to type the password you should click on the wifi indicator select the wifi network and then when the enter password screen appears push the wps button in the wifi ap this will automatically connect you without password. It worked in my ubuntu 18 and 20 machine.

3
  • In what setup have you tested this solution ? – breversa Aug 15 '20 at 18:40
  • Works 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 3: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 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.