Matthew Cantelon


For the past few weeks I have been setting up an old (circa 2003) laptop for my day to day usage. In doing so, I am having to learn how to setup common things (like wifi) from the command line. I have read a bunch of documentation and blog posts to get my network card working in Debian Buster and I hope this post brings all of it together.

Navigate this page:


You are going to want to be connected to the internet so that you can download packages if needed. If you are reading this, that probably means you will want to be cabled in.

There is an assumption that Debian has the correct driver for your wireless card. If this is not the case, you will need to look somewhere else for instructions.

Unsure if debian found your card? You can run iwconfig:

sudo iwconfig

You want to be on the lookout for something that looks like the below output. This will also tell you what the name of your card interface is, wlp6s0 for me.

wlp6s0    IEEE 802.11  ESSID:"Matt's Home Network"
          Mode:Managed  Frequency:5.68 GHz  Access Point: A1:B1:C1:D1:E1:F1
          Bit Rate=180 Mb/s   Tx-Power=19 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=54/70  Signal level=-56 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Now that you know your interface name, you can get the exact name of your SSID.

sudo iwlist wlp6s0 scan | grep -i ESSID

For the rest of this post, I will be using the following values and you will need to replace them with your own to successfully setup your card:

  • Wireless card interface name: wlp6s0
  • SSID: "Matt's Home Network"


Our first goal is to generate a wpa_supplicant configuration which will hold the details of the network as well as how it can be accessed. We can use a one-liner to generate the file. Before giving you that one-liner, I am going to break down the parts. If you just want things to happen, feel free to skip ahead.

What exactly is happening?

We run wpa_passphrase with root persmissions and pass it the SSID we want to connect to. The application then asks for the network password. After typing that in, it generates the appropriate configuration block. It would look something like this:

$ sudo wpa_passphrase "Matt's Home Network"
# reading passphrase from stdin
        ssid="Matt's Home Network"

The next step is to get the wpa_passphrase output into a configuration file. You can manually copy from the network={... line down or pipe the output of the command into tee which will handle writing the file with the correct permissions.

Thus, the one-liner is born:

sudo wpa_passphrase "Matt's Home Network" | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf > /dev/null

Don’t forget to enter your password and press Enter.


Try to run wpa_supplicant to see if any errors occur:

sudo wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlp6s0

If you get an error, try killing NetworkManager and then retry running wpa_supplicant.

sudo systemctl stop NetworkManager && sudo systemctl disable NetworkManager

If it looks like wpa_supplicant worked, you can open a new terminal, and then ping Cloudflare.

$ ping -c 5

PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=60 time=21.3 ms
64 bytes from icmp_seq=2 ttl=60 time=20.9 ms
64 bytes from icmp_seq=3 ttl=60 time=21.1 ms
64 bytes from icmp_seq=4 ttl=60 time=21.5 ms
64 bytes from icmp_seq=5 ttl=60 time=21.5 ms

--- ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 20.925/21.320/21.567/0.293 ms

At this point your wifi connection should be working so you can go ahead and kill the wpa_supplicant process by opening up that terminal and hitting Ctrl + C.

Start at boot

Now we need to create two services: one that connects to the appropriate network and one that requests an IP adress.

Connect to network

Make a copy of an existing wpa_supplicant.service and move it to /etc

sudo cp /lib/systemd/system/wpa_supplicant.service \

Update the ExecStart line to load in the configuration made earlier:

- ExecStart=/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
+ ExecStart=/sbin/wpa_supplicant -u -s -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlp6s0

Next, remove the Alias line:

- Alias=dbus-fi.w1.wpa_supplicant1.service

Finally, enable the service:

sudo systemctl enable wpa_supplicant.service

Get an IP address

Create a new service with systemd:

sudo systemctl edit --force dhclient.service

The contents you want to add are:

Description=DHCP Client

ExecStart=/sbin/dhclient wlp6s0


Now we can enable this new service:

sudo systemctl enable dhclient


We’re now in the final stages. Close down any open editors and reboot your system to confirm the automatic network connection works:

sudo systemctl reboot

Once that is working, you can go into your wpa_supplicant.conf and do two things:

  1. Allow access for users with sudo to modify via frontend applications like wpa_cli
  2. Remove the commented plaintext copy of your network password
-# reading passphrase from stdin
+ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=sudo
        ssid="Matt's Home Network"
-       #psk="blablabla"


I used a few:

Setup your Wifi Card from the Command Line in Debian Buster by Matthew Cantelon is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.