How to Find Your WiFi Password in Ubuntu: A Complete Guide

It's quite common to need to restore access to a wireless network but have lost the passphrase. Operating system Ubuntu, based on the Linux kernel, stores connection configurations in special protected files that can be accessed using various methods. Understanding the data storage structure will allow you to easily extract the necessary information without reinstalling the system or resetting the router.

Unlike some other operating systems, where settings can be scattered across the registry or hidden folders, Linux distributions have a clearly structured system. You can use the graphical interface if you have physical access to the desktop, or use the command line for deeper analysis. WPA2/WPA3 encryption keys are stored in clear text only after decryption by system utilities or in configuration files with limited access rights.

Below, we'll look at several proven methods that can help resolve access issues. Whether you use standard GNOME tools or advanced terminal methods, you'll find a suitable option for your distribution. Just be careful when working with system files.

Using the GNOME graphical interface

The easiest and safest way for beginners is to use the built-in network settings. In modern versions of Ubuntu using the GNOME desktop environment, connection management is located in a convenient panel. You don't need to enter complex commands; simply follow the menu.

To get started, open the system menu and go to Settings. Find the section for wireless connections. This displays a list of all networks your computer has ever connected to. Select the desired access point and click the Properties button or the gear icon.

In the window that opens, find the "Security" tab. The password field is usually hidden behind asterisks. To see the characters, click the corresponding eye or the "Show password" checkbox. The system may ask you to confirm administrator rights by entering your current username and password.

⚠️ Attention: If the view button is inactive or the field is gray, this may mean that the connection profile is stored only for the current user and you are logged in as a different user, or the configuration was imported without saving the key.

This method is ideal when you have access to a graphical shell. However, if the interface is frozen or you're working over a remote connection (SSH), you'll have to use the terminal. The graphical method is visually appealing, but less flexible for mass profile management.

Viewing passwords via terminal and nmcli

For those who prefer the command line, the utility nmcli (NetworkManager command-line interface) provides powerful tools. It allows you to manage network connections and, importantly for us, display saved keys in text format.

First, you need to get a list of all saved connections. This will help you find the exact profile name, which may differ from the network SSID. Enter the command to display the list, which will show the NAME, UUID, TYPE, and DEVICE.

nmcli connection show

Once you have identified the name of the connection you want (e.g. "HomeWiFi"), use the following command to display all the details, including the security key. Parameter --show-secrets is critically important, as without it the password will not be displayed.

nmcli connection show "YourConnectionName" --show-secrets

In the command output, look for the line 802-11-wireless-security.pskThis is where the key you're looking for will be listed. If the field is empty, it means the profile doesn't contain a saved password, and you'll need to enter it again.

  • 🔍 Accuracy: The command returns the exact value of the key without asterisks.
  • Speed: Instant results without navigating through menus.
  • 🛠 Versatility: Works on any distribution with NetworkManager.

Usage nmcli This is especially useful for script automation or remote server administration. You can quickly copy the output to the clipboard. This is a standard tool installed by default in most Ubuntu distributions.

📊 Which password recovery method is best for you?
Graphical interface
Command line (nmcli)
Direct reading of files
Resetting the router

Reading configuration files directly

System NetworkManager stores connection profiles in a directory /etc/NetworkManager/system-connections/The files in this folder contain all the necessary information, including the SSID and encryption keys, but access to them is closed to regular users by default.

To view the contents of this folder, you will need superuser (root) privileges. Use the command ls to display a list of files. The file names often match the connection names, but may have an extension .nmconnection or be without it.

sudo ls -l /etc/NetworkManager/system-connections/

To read the contents of a specific file, use the utility cat or a text editor like nanoDon't forget to add sudo before the command, otherwise you'll get an access error. Inside the file, look for the section [wifi-security] and parameter psk.

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

Inside the file, you'll see structured text. The key is in the line starting with psk=If you see the line psk_flags=1, this may mean that the key is stored in a keyring, not in the file itself, and cannot be read directly.

⚠️ Attention: Never edit or delete files in this directory manually unless you are confident in what you are doing. A syntax error may result in an inability to connect to the network after a reboot.

This method is good because it gives access to raw configuration data. It is indispensable when the graphical interface is not working, and nmcli For some reason, it doesn't display secrets. Understanding the Linux file structure is an important skill for an administrator.

☑️ Check file access

Completed: 0 / 4

Using the secrets utility (seahorse)

In the Ubuntu operating system, GNOME Keyring is responsible for storing secrets, including WiFi passwords, encryption keys, and application credentials. The utility seahorse (Interest "Passwords and Keys") allows you to manage this data through a graphical interface.

Launch the Passwords & Keys app from the app menu or by typing seahorse in the terminal. In the left panel, select the "Passwords" category. In the list on the right, find the item corresponding to your wireless connection. It's usually named the same as the network's SSID.

Double-click the desired item to open its properties. Go to the "Password" tab. Check the "Show password" box. The system will ask you to confirm your identity, after which the key will become visible in the text field.

This method is convenient because it consolidates all your saved passwords in one place. You can not only view your WiFi keys but also manage app access to the network. However, if you've changed your login password and haven't updated your keychain, access may be blocked.

  • 🔐 Safety: All data is protected by a master login password.
  • 📂 Centralization: A single repository for all types of secrets.
  • 👁 Visualization: Convenient interface for viewing and editing.

It is worth noting that seahorse Works only with profiles saved in the user's keychain. System profiles created for all users may be displayed here as read-only or not at all, requiring the use of a terminal.

What to do if you forgot your keychain password?

If you've changed your user password but haven't updated your keychain, the system may continually prompt you for the old password when you log in. In this case, you can create a new keychain, but your old saved WiFi passwords will be lost and you'll have to re-enter them.

Comparison of access recovery methods

The choice of recovery method depends on your skills and current situation. Each method has its own advantages and limitations. Below is a table to help you quickly navigate and choose the best option.

Method Complexity Requires GUI Availability
GNOME Settings Low Yes Active profiles only
nmcli Average No All profiles with rights
Configuration files High No Direct access to data
Seahorse Low Yes Custom only

As you can see from the table, for most users, using GNOME settings or the utility will be optimal. nmcliDirect file reading is recommended only for experienced users who understand the Linux structure. Graphical methods are less flexible but safer for beginners.

If you are working on a server without a graphical shell, nmcli becomes the only sensible choice. It provides complete control and requires no additional dependencies. In corporate environments, scripting methods are often used to audit settings.

Common problems and their solutions

Even following the instructions, you may encounter difficulties. Users often can't find a file, or the command returns an empty result. This may be due to access rights or the way profiles are stored in a particular version of Ubuntu.

One of the common problems is the lack of rights sudoWithout them, you won't be able to read the contents of system folders or see secrets in nmcliMake sure your account is part of the group. sudo and you enter the correct password.

It's also worth considering that some corporate networks use certificates and complex authentication methods (802.1x), where a standard password (PSK) may not be explicitly disclosed. In such cases, restoring access requires the intervention of a system administrator.

⚠️ Attention: Interfaces and location of settings may differ slightly depending on the version of Ubuntu (20.04, 22.04, 24.04) and the installed desktop environment (GNOME, KDE, XFCE).

If none of these methods work, the profile may have been damaged or deleted. In this case, the only option is to reset the router (if you have physical access) or obtain the password from the network owner. Software recovery methods only work on saved data.

Is it possible to recover a password if the system won't boot?

Yes, if you have a Live USB with Linux. After booting from the USB drive, mount the partition with Ubuntu installed and navigate to /etc/NetworkManager/system-connections/ to read the configuration files.

FAQ: Frequently Asked Questions

Where exactly on disk are WiFi passwords stored in Ubuntu?

The main storage is located at /etc/NetworkManager/system-connections/Files in this directory contain settings and encryption keys. Access to them requires root privileges.

Why doesn't the nmcli command show the password?

Most likely you forgot to add the flag. --show-secrets at the end of the command. Without this parameter, NetworkManager hides sensitive data for security purposes.

Is it safe to store passwords in plaintext in files?

Files in the folder system-connections have strict access rights restrictions (usually only root). However, if an attacker gains root access to your system, they will be able to read them. It is recommended to use complex passwords when logging in.

Is it possible to find out the password for a WiFi network I've never connected to?

No, Ubuntu can't crack passwords. It can only show the keys that were previously saved during a successful connection. Passwords are brute-forced using other tools and methods that don't involve restoring OS settings.