In our daily lives, we deal with passwords more often than we ever did just a decade ago. Most online services you use require a different ID and password. Before all of that though you probably had to create a password for your Wi-Fi.
A Wi-Fi password is easy to forget because you don’t really use it as often once you’ve signed in. If you do forget it, it can be a nightmare because there isn’t exactly a “forgot password” button anywhere. Don’t fret yet because like every other operating system, your Linux system saves your Wi-Fi passwords for you and you can easily view saved Wi-Fi passwords.
If you’re not as familiar with Linux, there are usually at least two ways to do anything on a Linux machine. Consequently, there are two ways to go about this as well. One of them is the command line method. We feel the command line is generally easy as long as you’re comfortable with it. All you’ll be doing is copying and pasting a few commands from here into a Terminal window, after all. Many aren’t comfortable with the command line though and fortunately for those of you, there is another way to get the same results with a few clicks here and there using the GUI (Graphical User Interface).
- Ubuntu is the more widely used Linux distro, therefore, we’re going to focus mostly on Ubuntu. However, you can still use the same commands on other Ubuntu based distros such as Linux Mint, Elementary OS, etc. The GUI method can be a little different since most of these Ubuntu derivatives use a different desktop environment. This will also be different even if you’re using Ubuntu but with a different desktop environment instead of Ubuntu.
- What we’re discussing here is not a hack or a crack of some sort against the built-in security measures in Linux, mainly Ubuntu. We’ll only be helping you find out your own Wi-Fi password from your own Linux system. You may have to do this when you’ve forgotten your Wi-Fi password and you want to connect a new device such as a phone, game console, etc. to the network. We do not encourage any malicious intents.
- Linux only saves your Wi-Fi network information if you had initially chosen to “connect automatically” while logging in to your Wi-Fi network the first time. This means if you did not choose to connect automatically during your initial login, Linux did not save your Wi-Fi password and so there is nothing to retrieve.
View Saved WiFi Password on Linux (Ubuntu) – Command Line
Ubuntu generally saves your WiFi network information under a “Network Manager” folder on your system. Inside this directory is a configuration file which can be accessed and thus, we can retrieve the Wi-Fi password.
- First of all, launch a Terminal window from your app launcher.
- Use the following command then to navigate to the folder where your Wi-Fi information is stored.
- With the ls command, we can get a list of all the saved Wi-Fi networks on your Ubuntu Linux system. You can skip this step if you know the network SSID already and if you’re sure you’ve allowed Linux to save the password when you logged in the first time.
- Now that you can the network SSIDs of all the saved network, use the command given below to retrieve the password for the Wi-Fi network you want. You’ll be required to enter your password after you enter the command since this is a root command.
sudo cat WIFI_SSID_NAME
For instance, my Wi-Fi SSID is MI so the command I’ll need to use would be as follows.
sudo cat MI
- The Terminal will now show you the saved WiFi information and under the [wifi security] section, you can find your password prefixed by psk=
What if You’re Using wicd?
It stands for Wireless Interface Connection Daemon and is an “open source software utility to manage both wireless and wired networks for Linux.”, as stated in the Ubuntu documentation. It “aims to provide a simple interface to connect to networks with a wide variety of settings.” In the odd chance that you’re using wcid to connect to your Wi-Fi network, you can find the configuration file in the
/etc/wicd folder. If you didn’t already know what this is, you probably don’t have to worry about it. In which case, you can forget we even mentioned wcid and the method above is perfectly valid for you.
- Navigate to the folder using this command:
- And then open the configuration file using the following command.
sudo cat wireless-settings.conf
You’ll find your password inside the file.
View Saved WiFi Password on Linux (Ubuntu) – GUI
The latest versions of Ubuntu use the GNOME desktop and they will continue to do so in the future. Therefore, we’re going to be using the GNOME desktop.
- Launch the GNOME Settings app from the app launcher or the System menu.
- In the Settings app, select Wi-Fi from the left column and you’ll be able to see all the available Wi-Fi networks on the right.
- Click on the gear icon next to the network that you want to see the password for. This icon can look slightly different depending on your current icon theme.
- This will launch a new window containing information about the network. Under the Security tab, check the box next to Show password and you’ll be able to see your password in the Password field.
Now that you have your password, you can note it down for future use or just let your Linux PC keep it for you..