View Saved Wi-Fi Passwords on Ubuntu
You can view previously connected Wi-Fi passwords by accessing the
NetworkManager configuration files. Ubuntu stores every saved connection in
plain text (the password is stored in the profile file, readable only with
root) under /etc/NetworkManager/system-connections/ — and since
the psk is stored in clear text, recovering a forgotten network
key is just a matter of reading the right file.
Step-by-Step Guide
List all saved Wi-Fi profiles:
ls /etc/NetworkManager/system-connections/The output is one file per saved connection, e.g.
MyWiFi.nmconnection.View the contents of a specific Wi-Fi profile:
sudo cat "/etc/NetworkManager/system-connections/<WiFi-NAME>.nmconnection"Replace
<WiFi-NAME>with the actual name of the Wi-Fi profile (file name).Locate the password: look for the line containing:
psk=your_wifi_password
Alternative: Use nmcli
If your profile shows psk-flags=1 (password stored in the system
keyring instead of the file), retrieve it with:
nmcli -s connection show <WiFi-NAME> | grep psk
-s (or --show-secrets) forces NetworkManager to
print secret values; it may prompt for the keyring password.
Notes
- Root access (
sudo) is required to read these files. - These files are stored in
.nmconnectionformat on modern Ubuntu versions using NetworkManager. - The network name shown in the Wi-Fi menu may differ from the file name — the file name is the connection profile name, which you can also confirm with
nmcli connection show.