How to connect to Wi-Fi AP through WPS?

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

7

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>
4

Solution from

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

  2. Stop the Network-Manager

    Using Upstart

     sudo stop network-manager

    Using Systemd

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

     sudo wpa_supplicant -B -Dwext -i**your_interface** -c/etc/wpa_supplicant.conf
  5. 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

  1. Run sudo dhclient **your_interface** to get IP from the AP (assuming DHCPd were enabled).

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

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

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

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.

  1. Steps 1-3 from .

  2. This one to enable the actual push: .
    In this case i used the push button not the pin.

  3. 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.
#
WIFIIF=$(grep wpa /proc/net/unix | cut -d \/ -f 4)
WPACONF=/etc/wpa_supplicant.conf
# steps 1-3
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" # 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 #
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like