How to Find Your WiFi Password on Linux: A Complete Guide

Linux-based operating systems are renowned for their flexibility and process transparency, but sometimes the standard graphical interfaces hide important network configuration details from the user. Needing to find the password for an already connected or previously used WiFi network often occurs, for example, when connecting a new device or reconfiguring a router. Unlike Windows, where access to stored encryption keys may not be obvious without administrator privileges, Linux provides powerful tools for managing network connections right out of the box.

Most modern distributions such as Ubuntu, Fedora or Linux Mint use NetworkManager for managing network interfaces. This means passwords are stored in secure configuration files, accessible through both the graphical interface and the command line. Understanding where this data is stored and how to retrieve it is a basic skill for any system administrator or advanced user.

In this guide, we'll cover several proven methods for recovering a forgotten password, ranging from simple graphical settings to analyzing system files. Whether you prefer working with the terminal or visual menus, you'll find a suitable solution.

Using the NetworkManager GUI

The easiest and most secure way to save a password is available to users running a graphical desktop environment such as GNOME, KDE, or XFCE. NetworkManager is integrated into most popular distributions and allows you to manage connections through the system tray or system settings. To get started, open the network connections menu, usually located in the upper-right corner of the screen.

Once you've opened Settings, select an active WiFi connection or find the list of saved networks in the "Wireless Network" section. Click the gear icon or the "Settings" button next to the desired SSID. In the window that opens, go to the "Security" tab. This is where the password field is displayed, hidden by asterisks by default.

To view the characters, simply check the "Show password" box. The system may prompt you to confirm superuser privileges by entering your account password. This is a standard security procedure to prevent unauthorized access to sensitive data.

⚠️ Note: If the "Security" tab is empty or the fields are locked, this may indicate that the connection is controlled by system policies or the configuration file has restricted access rights. In this case, try the methods described below using the terminal.

The graphical method is convenient for its clarity, but it's not always available if you're working on a server without a graphical shell or if the network interface is damaged. In such cases, command-line utilities come to the rescue.

📊 Which Linux distribution do you use most often?
Ubuntu/Debian
Arch Linux/Manjaro
Fedora/CentOS
Other (Gentoo, Slackware)
I'm just getting started

Viewing a password through the terminal using nmcli

Utility nmcli (NetworkManager command line interface) is a powerful tool for managing networks from the command line. It's preinstalled in many distributions and allows you to not only create new connections but also read the parameters of existing ones. To get started, open a terminal and enter the command to list all saved connections.

Run the command nmcli connection showto see a list of all profiles. Find your network name (SSID) in the list. Next, request detailed information about a specific connection, filtering the output by the security keyword. This will allow you to see key parameters at a glance, without unnecessary noise.

nmcli connection show "YourNetworkName" | grep 802-11-wireless-security.key-mgmt

However, to see the password itself, you need to request the field wifi-sec.key or 802-11-wireless-security.keyThe command will look like this:

nmcli -s -g 802-11-wireless-security.key connection show "Your_Network_Name"

There is a flag here -s stands for "secure", allowing sensitive data to be displayed, and -g Displays only the value of a specific field. If the network name contains spaces, be sure to enclose it in quotation marks.

☑️ Check before entering commands

Completed: 0 / 4

Usage nmcli This is especially effective for remote administration via SSH when the graphical interface is unavailable. This method works reliably on all versions of NetworkManager, starting with 1.x.

Analysis of configuration files in /etc/NetworkManager

All connection settings, including passwords, are stored in the Linux file system. By default, NetworkManager stores profiles in the directory /etc/NetworkManager/system-connections/. Files in this folder have the extension .nmconnection or simply correspond to the network name, and they contain all the necessary information in text form.

Since these files contain sensitive data, only the user has access to them. rootTo view the contents you will need to use commands cat, less or a text editor like nano with superuser rights. Find the file that matches your network and open it.

sudo cat /etc/NetworkManager/system-connections/"Network_name".nmconnection

Inside the file, look for the section [wifi-security]. Parameter psk (Pre-Shared Key) and will contain the desired password in cleartext. The file structure may differ slightly depending on the distribution version, but the key fields remain the same.

⚠️ Warning: Be extremely careful when editing files in this directory. Any syntax error in the configuration may prevent NetworkManager from seeing saved networks or automatically connecting to them. Read-only mode is recommended.

This method is the most reliable, as it goes directly to the source of truth, ignoring possible bugs in graphical utilities or command shells.

What to do if the file is unreadable?

If you get an access error when trying to open a file even with sudo, check whether the file is locked by immutability attributes. The lsattr /etc/NetworkManager/system-connections/ command will show the attributes. If the 'i' attribute is present, remove it with sudo chattr -i filename, but only do this if you are confident in your actions.

Using the wpa_supplicant utility

In some minimalist distributions or older configurations, WiFi management can be done directly through the daemon. wpa_supplicantIn this case, passwords are stored in a file /etc/wpa_supplicant/wpa_supplicant.confThis method is less common in modern desktop systems, but is critical for server builds and embedded devices.

The configuration file contains blocks network, which contain the SSID and encryption keys. The password can be stored in clear text (parameter psk="password") or as a hash (parameter psk=hex_string). If you see the hash, you won't be able to recover the original text password directly from the file, but you can use this hash to connect other devices.

To view the file, use the command:

sudo cat /etc/wpa_supplicant/wpa_supplicant.conf

If the password is encrypted and you need the plaintext value, you will have to use brute-force tools or reset the network settings and reconnect with a known password so that the system saves it in clear text in the new profile.

Understanding the differences between NetworkManager And wpa_supplicant helps you quickly navigate any Linux system, regardless of its configuration. In modern distributions, wpa_supplicant often functions as a backend for NetworkManager.

Comparison table of recovery methods

To help you choose the best password recovery method, consider a comparison chart of methods. It will help you determine which tool is best suited to your current situation and system access level.

Method Necessary rights Complexity Availability of GUI
Graphical interface User (sudo to view) Low Required
Nmcli (terminal) Custom Average Not required
Configuration files Root (sudo) Average Not required
Wpa_supplicant Root (sudo) High Not required

As can be seen from the table, for most home users, the best option remains a graphical interface or utility. nmcliDirect work with files is required in specific debugging cases.

Common problems and their solutions

During the password recovery process, users may encounter a number of common errors. For example, the command nmcli It may fail to find a connection if the profile name in the system differs from the network name (SSID). Profiles are often named "Wired connection 1" or have arbitrary names assigned upon initial connection.

Another common problem is lack of access rights. Even if you use sudo, some security policies (such as SELinux or AppArmor) may block reading of certain files. In such cases, check the system logs via journalctl to identify the reasons for the refusal.

It's also worth considering that in corporate networks using certificates (WPA2-Enterprise), the password may not be stored in clear text, as authentication occurs through external servers. In this case, recovery is limited to searching for credentials in the user's browser or password manager.

⚠️ Note: Interfaces and file paths may vary slightly depending on the distribution version (e.g., Ubuntu 20.04 vs. Fedora 38) and desktop environment used. Always consult your distribution's official documentation if the default paths don't work.

Knowing how to navigate these obstacles makes you a more confident Linux user. Don't be afraid to experiment with commands in a safe environment.

Questions and Answers (FAQ)

Is it possible to find out the WiFi password if I have never connected to this network from this computer?

No, Linux (like any other OS) cannot crack passwords remotely. The methods described only work for retrieving previously saved keys already in the system. To connect to a new network, the password must be known in advance.

Where are passwords stored in distributions without NetworkManager?

In such cases (often found in minimalist builds like Arch with manual configuration), passwords are usually stored in /etc/wpa_supplicant/wpa_supplicant.conf or in network initialization scripts such as /etc/network/interfaces (Debian/Ubuntu) or systemd-networkd configurations.

Is it safe to store passwords in text files?

Configuration files in /etc/ By default, these files are only accessible to the root user, providing a basic level of protection. However, if an attacker gains physical access to the device or root privileges, they can read these files. For enhanced security, use disk encryption.

Why does the nmcli command return the error "Error: No connections specified"?

This means there are no saved connection profiles in the system. This can happen if you're using a guest session, a Live USB, or if the profiles have been deleted. In this case, it's impossible to find the password through the system.

Is it possible to recover the password if it was entered incorrectly during the first connection?

If the connection failed, the password wasn't saved. If the system attempted to connect and saved the profile with an incorrect password, you'll be able to see the exact string that was saved (the incorrect one). To find the correct password, you need to know its source (router, ISP contract).