1. Overview

In today’s digital age, wireless internet connectivity is an integral part of our daily lives. Whether at home, work, or in public places, we rely on WiFi networks to stay connected.

When we connect to a WiFi network on a Linux system, it stores the WiFi password to facilitate automatic connections. But have we ever wondered where these WiFi passwords are stored?

In this tutorial, we’ll explore the location of WiFi passwords in a Linux system and learn how we can access and manage them.

2. CLI Method

Let’s start by learning how to view stored WiFi passwords using the command-line method.

2.1. Using NetworkManager

If we’re using a Linux distribution that uses NetworkManager (e.g., Ubuntu, Fedora, Debian with GNOME), WiFi passwords are stored in the NetworkManager configuration file. This file is located in the /etc/NetworkManager/system-connections/ directory.

Firstly, let’s list the network connection configuration files used by NetworkManager to manage network connections on our Linux system:

$ ls /etc/NetworkManager/system-connections
 Wlinkwifi                         'WIFI.nmconnection'                     GIF.nmconnection                 Homewifi.nmconnection
 office5G                           darshan.nmconnection                   Office WIFI                      Office2.nmconnection 

Secondly, let’s view the configuration file of Office WIFI using cat:

$ sudo cat /etc/NetworkManager/system-connections/Office\ WIFI 
[connection]
id=Office WIFI
uuid=1511c150-e307-4c2f-88c3-08eb7204501b
type=wifi
interface-name=wlan0
[wifi]
mode=infrastructure
ssid=Office WIFI
[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=CLnf7830nd59
[ipv4]
...  

The command output displays the contents of a network connection configuration file named Office WIFI located in the /etc/NetworkManager/system-connections/Office WIFI directory.

The file contains configuration settings information like ssid, wifi-security, ipv4, and so on. Further, it displays the stored password information, i.e., CLnf7830nd59.

2.2. Using nmcli

The powerful command-line tool nmcli manages network connections in Linux distributions that utilize NetworkManager as the default network management service.

With nmcli, we can connect to WiFi networks, create and modify network connections, display connection status, and more, all without the need for a graphical user interface.

Before we begin to retrieve stored WiFi passwords, let’s install nmcli first using apt:

$ sudo apt install network-manager

Once nmcli is installed, let’s check out the network configuration files used by NetworkManager to control the network connections on our system:

$ nmcli connection show
NAME                              UUID                                  TYPE      DEVICE  
Wlinkwifi                 6e88fb8b-2a48-4e07-9a86-1912ab97fd03  wifi      --      
'WIFI.nmconnection'       c0c7650d-e1e0-2728-8f59-66433c1efd49  wifi      --      
Homewifi.nmconnection     eb23f20d-24b3-4804-a76b-ce0748924b0c  wifi      --      
office WIFI               5a6dc4ac-2edc-4dbd-9c37-bce7df88b956  wifi      --      
...

Let’s select the SSID for Office WIFI and view its stored password using nmcli:

$ nmcli connection show "Office WIFI" | grep -i psk
802-11-wireless-security.key-mgmt:      wpa-psk
802-11-wireless-security.psk:           CLnf7830nd59
802-11-wireless-security.psk-flags:     0 (none)

The above command along with grep -i psk filters and displays security-related information (WPA-PSK key management and the PSK itself) for the Office WIFI network connection. We can see the stored WiFi password, i.e., CLnf7830nd59.

3. GUI Method

We can also view stored WiFi passwords using the GUI method. Here we’ll be using Kali Linux as a primary operating system.

Let’s navigate to Advanced Network Configuration by typing it in the search bar:

WiFi network configuration menu

The Advanced Network Configuration setting displays all the WiFi network connections.

Next, let’s select the Office WIFI, click on the edit setting as highlighted in yellow below, and click on the Wi-Fi Security tab to view the stored password:

Wifi-Network-configuration-password

Upon clicking the check mark on Show password, the Wi-Fi Security tab displays the stored password in clear text.

4. Conclusion

In this article, we explored both the command-line method and the GUI method to view stored WiFi passwords in Linux.

Whether through NetworkManager configuration files, the nmcli command-line tool, or a GUI interface, we can view the stored WiFi password. Understanding these methods empowers us to maintain reliable and seamless WiFi connections on Linux systems.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.