How to View Your WiFi Password on Ubuntu: A Complete Guide

operating system UbuntuLike most modern Linux distributions, by default stores data about connected wireless networks in encrypted or hidden form for security. Users often encounter situations where they need to connect a new device, such as a smart TV or smartphone, to the same network, but have forgotten the password and cannot access the router's web interface. Unlike Windows, where the process may be obscure, Linux offers several effective methods for extracting this data.

Recovering a forgotten access key is possible thanks to the fact that NetworkManager, the standard network management tool in Ubuntu, stores successful connection configurations in plain text in system folders. This allows administrators and advanced users to quickly access the necessary information without third-party software. The only requirement is physical access to the computer and superuser privileges.

In this article, we'll cover three main methods: using the graphical settings interface, the command line, and directly reading system files. Each method has its own advantages, depending on whether you have a graphical shell installed. GNOME Or you're working on a server version of the distribution. We'll also cover common errors and the nuances of working with access rights.

⚠️ Attention: All steps below require administrator privileges (sudo). Make sure you're using a computer to which the network has previously been connected, as recovering the password for a network to which the device has never been connected using standard Linux tools is impossible.

Using the GNOME graphical interface

The easiest and safest way for beginners is to use the built-in network settings in the graphical shell. This method doesn't require any knowledge of commands and is ideal if you're working on a regular desktop or laptop with Ubuntu DesktopThe interface may differ slightly between versions, but the logic remains the same.

To begin, open the system settings menu, usually accessible through the gear icon or the top taskbar. You'll need to navigate to the section responsible for network connections. In modern versions of Ubuntu, this path looks like this: Settings → Wi-Fi or Network → Wi-Fi. A list of available and saved networks will be displayed here.

Find your target network in the list and click the settings button (often a gear icon next to the network name). This will open a properties window, looking for the "Security" tab. This is where the password field is hidden, hidden by asterisks by default.

  • 🔑 Click the "eye" icon or the "Show password" checkbox to see the characters in plain text.
  • 📋 Copy the displayed character combination to your clipboard for later use.
  • 🛡️ Make sure the encryption method is listed as WPA2 or WPA3, which confirms the security protocol is up to date.

If the password field is inactive or the view button is missing, this may mean the system stores keys only for the current user, and you're trying to view global settings. In this case, try logging in as the same user you used to initially connect.

📊 Which Ubuntu interface are you using?
GNOME (standard)
KDE Plasma
XFCE
Cinnamon
Another

Viewing a password through the terminal using nmcli

For users who prefer the command line, or for those who work on server versions without a graphical interface, the utility will be the ideal tool nmcli (NetworkManager command line interface). It is pre-installed in most Linux-based distributions. Debian And Red Hat and allows you to manage network connections with high precision.

The first step is to identify the exact connection name, which may differ from the network's SSID. Enter the command to list all saved profiles. This will display the UUID, device type, and current connection status, which will help avoid confusion if you have multiple saved profiles.

nmcli connection show

Once you've found the desired connection name (the NAME column), use the following command to display all details, including the hidden security key. Please note that running this command will require you to enter the user password via sudo, since the data is protected by system access rights.

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

However, a more direct way to see the password is to request a specific field. The command below will display only the passphrase if it's saved in the profile. This is especially convenient if you need to quickly copy data without unnecessary visual clutter.

sudo nmcli -s -g 802-11-wireless-security.psk connection show "Your_Network_Name"
⚠️ Attention: If the command returns an empty string or an error, check that the connection name is specified correctly. It must match the name in the connection list verbatim, including case and special characters.

☑️ Check before entering commands

Completed: 0 / 4

Analysis of system configuration files

The operation of network services is based on Ubuntu There is a file system where each connection profile is represented by a separate configuration file. These files are stored in the directory /etc/NetworkManager/system-connections/Direct reading of these files provides the most complete access to data, including access point MAC addresses and encryption type.

By default, this folder is closed to regular users. You'll need to use a file manager with root privileges or a terminal. When opening files, you'll see structured text divided into sections, with wireless network settings highlighted in a separate block.

Find the file with the corresponding name (often the same as the network name, but may have an extension .nmconnection). Inside the file, look for the section [wifi-security]That's where the parameter is located. psk, the value of which is your password in clear text.

Parameter Description Location in file
ssid Wireless network name [wifi]
psk Security key (password) [wifi-security]
key-mgmt Key management type (WPA-PSK, etc.) [wifi-security]
mode Operating mode (infrastructure/adhoc) [wifi]

If you are using a terminal, the command is cat or less will allow you to quickly display the file contents on the screen. Don't forget to add the prefix sudo to bypass access restrictions. This is a universal method that works even if the graphical interface is frozen or displays data incorrectly.

sudo cat /etc/NetworkManager/system-connections/"Network_Name".nmconnection
What to do if the file won't open?

If you receive the "No such file or directory" error, connections may be stored in the user profile. Check the ~/.config/NetworkManager/connections/ folder or use the find command to search for the file by network name.

Working with access rights and permissions

Linux security is built on strict permissions. Network configuration files are often user-owned. root and have access rights that prohibit reading by standard users. This is done to prevent theft of credentials by malware or unauthorized individuals.

If you try to open a file using a text editor without elevated privileges, you will receive an error message. sudo before the command temporarily grants you superuser privileges. However, be careful: manually editing the contents of these files may result in loss of network connectivity.

If you plan to frequently work with network settings, you can add your user to the group netdev, which will provide extended network management rights but not full access to system files. This is a balance between convenience and security.

  • 🔒 Use sudo read-only, avoiding editing files unless absolutely necessary.
  • 👥 Check group memberships with a command groupsto understand your current rights.
  • 📝 Create backup copies of configuration files before any changes using the command cp.
⚠️ Attention: Never change the owner of files in a folder /etc/NetworkManager/ to a standard user. This may disrupt the NetworkManager service and result in an inability to connect to the internet after a reboot.

Alternative methods and utilities

In some cases, standard tools may be unavailable or inconvenient. Then specialized utilities and scripts come to the rescue. For example, the program Wireless Tools or graphical password managers that integrate into the desktop environment.

One of the effective ways is to use the utility secret-tool, which is part of the package libsecretIt allows you to search for stored secrets in the system keystore. This is especially useful if NetworkManager is configured to use GNOME Keyring or KWallet.

secret-tool lookup network.password ssid"Your_Network_Name"

This method is often more secure in corporate environments where security policies may restrict direct access to configuration files. It accesses the user's encrypted password storage, unlocking access after entering the login password.

Troubleshooting and diagnostics

Even following the instructions may cause errors. Often, the problem is that the network was marked as accessible "only to this user," and the files are located in the home directory, not the system directory. It's also worth checking the status of the NetworkManager service.

If the team nmcli If the service can't find a connection, make sure the service is running. Sometimes, after a system update or hardware change, the profile may have been deleted or corrupted. In this case, it's easier to reconnect to the network and remember the password.

For diagnostics use the command journalctl -u NetworkManager, which will display a detailed network service event log. By analyzing the logs, you can understand why a password isn't accepted or why a profile isn't loading.

Frequently Asked Questions (FAQ)

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

No, this is impossible. Linux (like other operating systems) only stores passwords that have been successfully entered and saved during previous connections. Hacking into other people's networks without authorization is illegal.

Where are passwords stored in Ubuntu Server without a GUI?

In the server version, passwords are stored in files at the path /etc/NetworkManager/system-connections/Since there is no GUI, the only way to see them is to open these files through the terminal with root privileges.

Why does the nmcli command give the error "secret agent not available"?

This error means there is no active agent for entering passwords (often occurs in minimalist environments). In this case, use direct viewing of configuration files or the utility secret-tool.

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

Files in /etc/NetworkManager/ They are protected by root access rights, making them safe from regular users. However, if someone gains physical access to your computer and root privileges, they will be able to read them.