It's quite common to need to connect a new device to a wireless network but forget the password. In the operating system UbuntuLike other Linux distributions, all connection data is stored in protected system files or in the keyring. This provides a high level of security, but creates difficulties for the average user who wants to quickly find a specific combination of characters.
There are several ways to extract this information, ranging from simple graphical methods to advanced terminal commands. The specific method you choose depends on your current distribution version, as network management interfaces in GNOME And KDE Change periodically. We'll look at the most current and proven options.
Before you begin any technical manipulations, it's important to understand that access to this data requires administrator or authorized user rights. The system protects these settings for a reason, so teams You'll be asked for confirmation. Don't be alarmed by password prompts when entering instructions—this is a standard Linux kernel security procedure.
Using the NetworkManager GUI
The easiest and most accessible way for most users is to use the built-in tools of the graphical shell. In modern versions of Ubuntu that use the environment GNOMENetwork management is located in a convenient panel. You don't need to enter complex commands; simply navigate through the settings menu step by step.
To get started, open System Preferences and go to the Wi-Fi section. Find a network you're already connected to or one saved in the known list. Click the Properties button or the gear icon next to the network name. In the window that opens, find the Security tab, where the password field is usually hidden.
- 🔍 Click on the eye icon to reveal the hidden password text.
- 🔑 The system may ask you to enter your user account password for confirmation.
- 📋 Copy the displayed symbols and save them in a safe place.
This method works reliably in recent releases, such as 22.04 and 24.04. However, in older versions or alternative shells, the layout of the elements may differ. If you don't see the Show Password button, try switching to the "Options" tab and then back; sometimes this refreshes the interface.
⚠️ Note: On some enterprise Linux distributions, the graphical interface may be limited by administrators. If the view password button is missing or disabled, proceed to terminal-based methods.
Viewing a password through the terminal using nmcli
For those who prefer speed and accuracy, the utility nmcli (NetworkManager Command Line Interface) is an indispensable tool. It allows you to manage network connections directly, bypassing graphical add-ons. This method is especially effective when the graphical interface is malfunctioning or unavailable.
The first step is to find out the exact name of your connection. Enter the command to list all known networks. The system will display a table with connection names, their UUIDs, and types. Find the Wi-Fi network you need in the list and note its full name or identifier.
nmcli connection show
Once the connection name is defined, use the following command to display all parameters, including security keys. Note that this operation requires root privileges, so the command is prefixed with sudo.
sudo nmcli connection show "YourNetworkName" | grep 802-11-wireless-security.psk
The result will be a string containing the desired password in cleartext. This is one of the fastest methods, and it works on almost all distributions where NetworkManagerIf the password field is empty, the network may use a different authentication method, such as WPA3 or an enterprise certificate.
- 🚀 Instant access to data without unnecessary clicks.
- 🛠 Possibility of process automation through scripts.
- 📝 Accurate information output without graphic distortion.
Analysis of system configuration files
The Linux operating system stores connection settings in special configuration files. In the case of NetworkManager, these files are usually located in the directory /etc/NetworkManager/system-connections/Directly viewing these files may provide an answer, but modern versions of Ubuntu encrypt sensitive data.
To view the contents of a directory, use the command ls with .root rights. You will see files with the extension .nmconnection or simply network names. Trying to open such a file with a text editor cat or nano may show a line where the password has been replaced with a set of asterisks or a hash.
| File location | Access | Data format |
|---|---|---|
| /etc/NetworkManager/system-connections/ | Root only | Keys (keyfile) |
| /var/lib/NetworkManager/ | Systemic | Internal data |
| ~/.config/NetworkManager/ | User | Temporary caches |
If files are encrypted or hidden, the direct reading method will not work without prior decryption, which requires complex key manipulation. libsecretTherefore, this method is more often used for backing up settings or manually editing network parameters, rather than for extracting passwords in their pure form.
In some cases, especially on server versions of Ubuntu without a graphical shell, settings may be stored in a file /etc/netplan/However, static IP addresses are more often specified there than Wi-Fi passwords, which are still pulled from secure storage.
Why are configuration files hidden?
System network settings files are hidden from the average user to prevent accidental corruption of critical connection parameters. Changing access rights to them could disrupt the network subsystem.
Working with the GNOME Keyring keystore
In Ubuntu graphical environments, a special daemon is responsible for storing passwords, including Wi-Fi ones - GNOME KeyringThis is a centralized storage that encrypts data using the user's password when logging in. The contents of this storage can be accessed through a utility. secret-tool.
To find a password, you need to know the attributes under which it was stored. Typically, this is the network name (SSID). The search command requires an exact match of attributes. You can first try searching for the entry using the attribute wifi-ssid or network-name.
secret-tool lookup wifi-ssid "Your_SSID"
If the command returns a result, you'll get a string with the data. However, the password is often stored in an attribute. password within the found record. For a deeper search, you can use the flag --allto display all available attributes of the found key.
- 🔐 High level of cryptographic data protection.
- 🧩 Integration with other GNOME applications.
- ⚙️ Flexible configuration via command line.
This method is the most "native" for desktop Ubuntu. It ensures that even if someone gains access to the configuration files, they won't be able to read passwords without authorization in the user's session. This is an important aspect. information security.
⚠️ Warning: If you changed your login password but didn't update your encryption keys, GNOME Keyring may no longer unlock automatically. In this case, accessing saved Wi-Fi passwords using this method will be difficult until you reset your keys.
☑️ Check before entering commands
Using the Wi-Fi Recovery Utility
There is a specialized set of scripts and snails, such as wifi-password (often available in repositories as part of pentesting or administration packages) that automate the extraction process. However, in standard Ubuntu, it's easier to use the built-in capabilities. nmcli in export mode.
You can export the connection profile to a new file where the password will be explicitly specified. To do this, use the command nmcli connection export or creating a new profile based on an existing one with modified display settings. This allows you to bypass direct viewing restrictions.
An alternative option is to use a utility cat in combination with grep on backup files, if you previously backed up the system at a time when passwords could be stored in clear text (relevant for very old versions of Ubuntu before 17.04).
For modern systems, the most effective "express method" remains creating a temporary hotspot or using a phone to scan a QR code, if this feature is available in Ubuntu's network settings, and then reading the data from the mobile device.
Restoring access in case of complete data loss
In situations where none of the software methods have helped (for example, if the NetworkManager database is corrupted or the hardware has been replaced), physical access to the router remains. If you have access to the local network via cable or can connect to the router via WPS, you can log in to the admin panel.
The control panel address is usually located on a sticker on the bottom of the device. By logging into the router interface with administrator rights (the login and password are often also listed on the sticker), you can view the Wi-Fi password in the Wireless Settings section. There, you can not only view it but also change it to a new one you'll definitely remember.
If access to the router is lost, the only option is to reset the device to factory settings (press the Reset button). This will return the password to the default value printed on the device, but will require reconfiguring all provider settings.
- 🔄 Reset the router settings using the Reset button.
- 📄 Search for the sticker with the factory password on the case.
- 🌐 Login to the web interface 192.168.0.1 or 192.168.1.1.
This radical method guarantees restoration of network control, but requires time to reconfigure. Therefore, regularly backing up your router settings and storing passwords in a password manager is the best preventative measure against such situations.
Is it safe to store Wi-Fi passwords in text files?
Storing passwords in plaintext files on disk is not recommended, as any virus or attacker with access to the file system can read them. It's better to use built-in browser password managers or specialized applications like KeePassXC, which encrypt the database with a single master password.
Is it possible to find out a neighbor's Wi-Fi password using Ubuntu?
No, legal methods only allow you to discover passwords for networks to which your computer has previously connected and stored data. Attempting to hack other people's networks using tools like Aircrack-ng is illegal and beyond the scope of this guide.
Where can I find saved passwords if I upgraded to a new version of Ubuntu?
NetworkManager settings are usually preserved when upgrading the system. If you performed a clean installation, old passwords will remain only if you backed up and transferred the contents of the /etc/NetworkManager folder and your GNOME Keyring keys. Otherwise, you'll have to reconnect the system.
Why does the nmcli command return a "Not authorized" error?
This error means your current user doesn't have permission to read the system's network settings. Make sure you use the sudo command before the prompt, or add your user to the netdev group. For one-time operations, it's easier to use sudo.