How to view your Wi-Fi password on a Linux computer

Kernel-based operating systems Linux Network keys are often used by both enthusiasts and system administrators to manage their network environments. Recalling a forgotten password for a wireless network to which a device is already connected or has previously connected occurs quite frequently. Unlike some proprietary systems, where access to stored keys can be hidden behind deep interface settings, in Linux this data is stored in text configuration files or databases, accessible using standard tools.

Recovering a forgotten security key does not require installing third-party software or using complex graphical utilities. Distributions Linux systems like Ubuntu, Debian, Fedora, or Arch Linux provide powerful command-line tools that allow you to instantly extract the information you need. Understanding where and how data is stored network profiles, gives the user complete control over their network security and allows them to quickly respond to changes in the infrastructure.

In this guide, we'll cover several proven password extraction methods, from using a graphical interface to advanced terminal commands. You'll learn how to use the utility. nmcli, how to read configuration files directly, and how to use graphical network managers. Whether you prefer the minimalism of the console or are accustomed to visual settings, you'll find a suitable solution.

Using the NetworkManager GUI

Most modern Linux distributions use it by default. NetworkManager for managing network connections. It's a de facto standard that provides a user-friendly graphical user interface (GUI) for connecting to Wi-Fi. If you're using a desktop environment like GNOME, KDE Plasma, or XFCE, you can view your saved password through system settings without entering complex commands.

To do this, you need to open the network management menu. Depending on the network you are using desktop shellsThe path may differ slightly, but the logic remains the same. Typically, you need to go to the Wi-Fi section, select the desired network, and open its properties. The window that opens often contains a "Security" or "Settings" tab, where the encryption key is hidden behind asterisks.

To see the actual symbol, click the corresponding eye icon or check the "Show password" box. The system may prompt you to confirm superuser privileges by entering your current login password. This is a standard security measure to prevent accidental disclosure of sensitive data by unauthorized persons with physical access to the unlocked screen.

⚠️ Attention: In some desktop environments (especially older GNOME builds or specific KDE themes), the password display button may be hidden or missing. If there's no visual way to do this, try terminal-based methods.

The advantage of the graphical method is its simplicity and the fact that you don't need to remember command syntax. However, if you're working on a remote server via SSH or using a minimalist window manager, this method won't be available. In such cases, command-line tools, which work on any distribution with NetworkManager installed, come to the rescue.

📊 Which graphical interface do you use most often?
GNOME
KDE Plasma
XFCE
MATE/Cinnamon
Other (i3, Sway, etc.)

Viewing a password through the terminal using nmcli

Utility nmcli (NetworkManager Command Line Interface) is one of the most powerful network management tools in Linux. It allows you to not only connect to access points but also inspect (analyze) existing connections in detail. To view the password, we need to know the connection name and run the command as root.

The first step is to identify the desired profile. Even if you're currently connected to the network, the system may have a history of dozens of other connections. The command nmcli connection show will display a list of all known profiles. Find your Wi-Fi network name (SSID) or connection name, which often matches the network name.

Once the connection name is determined, you can request the display of all its parameters, including hidden security fields. The key here is the use of the flag --show-secrets, which forces sensitive data to be displayed. Without this flag, the password will be replaced with an asterisk or an empty value for security purposes.

sudo nmcli connection show "YourSSID Name" --show-secrets

In the command output you need to find a line containing wifi-sec.key-mgmt (encryption type) and directly wifi-sec.psk. It is the value of the field psk (Pre-Shared Key) is the Wi-Fi password you're looking for. This method is universal and works on almost all distributions that use NetworkManager, including Ubuntu, Linux Mint, Fedora, and CentOS.

☑️ Check before entering a command

Completed: 0 / 4

Analysis of configuration files in /etc/NetworkManager

For those who prefer to work directly with the file system or don't have access to the nmcli utility, it's possible to extract passwords from configuration files. NetworkManager stores connection profiles in a directory. /etc/NetworkManager/system-connections/These are text files containing all connection parameters, including encryption keys.

However, access to this directory is strictly restricted. By default, files are owned by the root user and group, and the permissions are set so that a normal user cannot read them. This is an important feature of the Linux security architecture, protecting stored keys from programs running as a normal user.

To view the contents of a file, you need to use the command cat or a text editor (for example, nano or vim) with superuser rights. The file name usually matches the network name, but spelling changes may occur (for example, spaces replaced with underscores).

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

Inside the file you need to look for the section [wifi-security]. Parameter psk= will contain the password you are looking for in clear text. If the file has the extension .keyfile Whether it has no extension or no extension, the structure remains similar. It's important to be careful when editing these files manually, as a syntax error can result in an inability to connect.

Parameter Description Where to look
ssid Wireless network name Section [wifi]
psk Access password (key) Section [wifi-security]
key-mgmt Key Management Type (WPA/WPA2) Section [wifi-security]
mode Operating mode (infrastructure/adhoc) Section [wifi]

Using the wpa_passphrase utility

In some cases, especially in minimalistic systems or when using wpa_supplicant Instead of NetworkManager, you may need to generate or verify a password hash. Utility wpa_passphrase included in the package wpa_supplicant allows you to create a configuration file for connection, knowing the SSID and password.

Although this utility is most often used for creating new configurations, it's also useful for diagnostics. If you know the password but want to make sure it's correct for a specific network, or you need to obtain the PSK in hexadecimal format for debugging, this tool is indispensable. It takes the network name and password as input, producing a ready-made configuration block.

wpa_passphrase"MyNetworkSSID""MyPassword123"

The result of executing the command will be a block of text containing ssid And psk as a hash. The reverse operation (deriving a password from a hash) is impossible due to the one-way nature of hashing, but for understanding how the system processes your password upon connection, this method is very informative.

⚠️ Attention: Team wpa_passphrase can save the entered password in the shell command history (bash history). It is recommended to clear the history after use or use the command with caution on shared computers.

This method is more suitable for system administrators configuring servers without a graphical interface, where network management is performed through direct editing of configuration files. wpa_supplicant.confFor the average Linux desktop user, nmcli or GUI methods are more convenient.

What to do if the password does not work?

If the extracted password doesn't work, check your keyboard layout when you typed it. The password may contain special characters that were escaped when saved. Also, make sure you're connecting to the correct frequency (2.4 GHz or 5 GHz) if your router broadcasts multiple networks with the same name.

Working with keys in KDE Wallet and GNOME Keyring

Modern Linux distributions often use key management systems (Keyrings) to securely store passwords, certificates, and SSH keys. When you connect to Wi-Fi, the password may be stored not only in the NetworkManager configuration file, but also encrypted in GNOME Keyring or KDE Wallet (KWallet).

These vaults protect data with a user password. If you've changed your login password but haven't updated your keychain, the system may prompt you to unlock it each time you log in. To view saved Wi-Fi passwords through these utilities, you can use graphical managers such as seahorse (for GNOME) or kwalletmanager5 (for KDE).

In the "Passwords and Keys" app (seahorse), go to the "Passwords" or "Login" section. In the list of objects, find the entry corresponding to your wireless connection. Double-clicking on the entry will open its properties, where you can check the "Show password" box in the "Password" tab.

Using keychains adds an additional layer of abstraction and security. This is especially useful if you use disk encryption or want to centrally manage access to secrets. However, for quickly viewing a Wi-Fi password, the terminal method is often faster and less dependent on graphical libraries.

Frequently Asked Questions (FAQ)

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

No, it's impossible. Linux (like any other OS) doesn't magically reveal the password for a network the device hasn't connected to and whose details haven't been previously saved. Connecting requires a valid key or physical access to the router.

Where are Wi-Fi passwords stored in distributions without NetworkManager?

In systems using wpa_supplicant directly (often in server builds or older distributions), passwords are stored in a file /etc/wpa_supplicant/wpa_supplicant.confThe file may be encrypted or contain hashes, but often the password is in plain text in the field psk.

Is it safe to store passwords in plain text configuration files?

Storing in files like /etc/NetworkManager/system-connections/ It's considered fairly secure provided that permissions are configured correctly (root only). However, if an attacker gains root access to the system, they can read these files. For increased security, external encryption modules or keychains can be used.

What does the error "Error: connection not found" mean when using nmcli?

This error means that there is no saved profile with the specified name on the system. Check the list with the command nmcli connection show and make sure you're using the exact connection name (including case and special characters). The connection may have been deleted or never saved.

Is it possible to recover the password if I reset the router?

Resetting the router to factory settings deletes all user configurations, including the changed Wi-Fi password. After the reset, the router will revert to the password on the sticker on the router (if it hasn't been changed previously) or will require initial setup. The computer won't remember the password if the connection profile was deleted along with it.