When we connect to the Internet using a wireless/WiFi connection, we do so by entering the password and mostly checking the “connect automatically” option for future use. However, we rarely note down the password manually somewhere for future reference. The problem arises when we need the password again, for example when a visitor asks for it. Fortunately, our Ubuntu system saves this password, and all the connection configurations, for all the wireless connections you ever connected to. These are referred to as your “known” wireless connections. These passwords and other configurations can be easily retrieved through the Ubuntu command line and the graphical user interface.
In this article, we will describe two ways for you to find the saved passwords for your wireless connections:
- Through Ubuntu Settings Utility(UI)
- Through the Terminal application (command line)
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
Through Ubuntu Settings Utility (UI)
The Ubuntu Settings utility lets you manage your network connections, including the wireless ones. In order to fetch the password for a wireless connection, we will be using the WiFi view in the settings utility.
You can open this view from the following three methods:
1. Enter the WiFi keyword in the application launcher search bar as follows:
Then click on the Wi-Fi search result. This will open the Settings utility in the Wi-Fi view.
2. Click on the downward arrow located at the top-right corner of your Ubuntu screen.
Then click the settings icon, as shown above, from this menu. This will open the Settings utility which opens in the Wi-Fi view by default.
3. Click on the downward arrow located at the top-right corner of your Ubuntu screen.
Then click on the name of the connected WiFi connection and select Wi-Fi Settings option from the sub-menu. This will open the Settings utility in the Wi-Fi view.
In case no WiFi connection is connected, click on the Wi-Fi Off option from the menu as follows:
This is how the Wi-Fi view looks like:
Click on the Settings icon from the top bar as follows:
Then click on the Known Wi-Fi Networks option from its menu. This will give you a list of known WiFi networks, the ones you have ever connected to.
Then, click the settings icon adjacent to the connection whose password you want to fetch. This will open the Details of this WiFi connection. Click on the Security tab to view its security settings:
Here, you will be able to see the Password file. By default, the password is kept confidential in asterisks form. Select the Show Password option in order to view the password in an alphanumeric format as follows:
Through the Terminal application (command line)
For a Terminal-savvy person, the Ubuntu command line has a solution to all the administrative and configuration related problems. In fact, the command line gives greater control to a Ubuntu admin to make/view minute configuration details.
Anyways, let us see how we can make use of the command line to fetch saved passwords for our WiFi connections. The configuration details about your know wireless/WiFi connections are saved in the /etc/NetworkManager/system-connections directory. Individual configuration files are maintained for all your WiFi connections here.
Open your Ubuntu command line, the Terminal, either through the Ubuntu application launcher search bar or by using the Ctrl+Alt+T shortcut.
Then enter the following command as sudo:
$ sudo grep psk= /etc/NetworkManager/system-connections/*
The purpose of this command is to fetch the psk(password) value from the respective WiFi connection configuration files. Since only an authorized user is allowed to view/change the content of these files, you need to run the command as sudo.
This is how a wireless connection file looks like when opened in the nano editor:
The psk value corresponds to the saved password for the WiFi connection that you are looking for.
So these were two ways to fetch saved password for your WiFi/Wireless connections. You can now share them with visitors so that they can use the WiFi too.