Recover WiFi Passwords Using Linux

Group of smiling people carrying a big key and walking
alashi / Getty Images

When you first logged in to your WiFi network using your Linux computer, you probably allowed it to save the password so that you didn't need to enter it again.

Imagine you got a new device such as a phone or games console that also needed to connect to the wireless network.

You could go hunting for the router and, if you are lucky, the security key is still listed on the sticker at the bottom of it.

It is actually easier just to log in to your computer and follow this guide. 

Find the WiFi Password Using the Desktop

If you are using the GNOME, XFCE, Unity, or Cinnamon desktop environments, then the tool used for connecting to the internet is probably called Network Manager.

For this example, we are using the XFCE desktop environment.

  1. Click on the network icon in the panel and click on Edit Connections.
  2. Find the WiFi connection you wish to find the password for and click on Edit
  3. Click on the tab called WiFi Security.
  4. The password will be shown as a list of asterisks. You can show the actual password by clicking the Show Password checkbox.

Find the WiFi Password Using the Command Line

You can usually find the WiFi password via the command line by following these steps:

  • Open a terminal window
  • Type the following command to navigate to the folder where the connections are stored:
    • cd /etc/NetworkManager/system-connections
  • Type the following ls command to get a list of networks:
    • ls
  • Type the following cat command to list the file to the terminal window:
    • sudo cat 
  • Look for the section called [wifi-security]. The password is usually prefixed by "psk=".

What If I Am Using wicd to Connect to The Internet?

Not every distribution uses Network Manager to connect to the internet although most modern distributions do.

Older and lightweight distributions sometimes use wicd. 

Follow these instructions to find the passwords for networks stored using wicd.

  • Open a terminal window
  • Type the following command to navigate to the folder where the connections are stored:
    • cd /etc/wicd
  • Open the wireless settings file:
    • sudo cat wireless-settings.conf

The passwords for the WiFi networks are stored in this file.

Other Places to Try

In the past, people used to use wpa_supplicant to connect to the internet. 

If this is the case use the following command to locate the wpa_supplicant.conf file:

sudo locate wpa_supplicant.conf

Use the cat command to open the file and search for the password to the network you are connecting to.

Use the Router Settings Page

Most routers have their own settings page. You can use the settings page to show the password or if in doubt, change it.

  • Connect to the network you wish to show the password for.
  • Open a web browser and type 192.168.1.1
  • You will normally see an option called settings or a login option.
  • Log in to the admin page. (Unless you have changed the password, a lot of routers have the user and password set to admin, which you should change at the first opportunity).
  • You are now looking for the page in the settings screens that shows details about the WiFI and, in particular, the password. Quite often, there will be a password masked by asterisks with a "show password" checkbox next to it.