3

I'm asking because I just wittnessed the demise of my laptop's motherboard, but luckily got another almost identical laptop lying around (same model), just with a tiny ancient HDD and without much RAM left (plundered some other day already).

So all I did was move the HDD and the RAM from my smoked laptop to the one lying around and turn it on. Everything worked fine, but I noticed it didn't know the WiFi passwords of the WLANs I was recently using. I was always under the impression those are stored on the HDD, apparently not.

So where are they stored? Somewhere inside the WiFi substystem/chips?

EDIT: Thanks, I looked into the suggested duplicate question. It doesn't actually answer where the passwords are store, though. I learned they are stored below /etc/NetworkManager/system-connections, yet obviously this mount doesn't eventually reference the HDD, since after moving it the passwords were lost. So the question would be where it is actually stored

1
  • look at the second answer in the link you will it. Dec 28, 2016 at 20:34

2 Answers 2

6

Wireless passwords are indeed stored on the hard drive, in something known as a "connection profile." Connection profiles, essentially, have everything the system requires to connect to every network. However, they also contain a field to identify which device the profile belongs to:

enter image description here

When the system tries to establish a connection using the profile it has for that WiFi network, it notices that the device IDs don't match, and therefore the profile is skipped. As no valid profile is discovered, the system assumes that the WiFi network is new and hasn't been used before. Therefore, none of the settings for the network exist, and you have to re-enter your password.

If you'd rather not re-create a new wireless profile, you can always change the device using the Connection Editor (Edit Connections under the Wi-Fi icon), which will then allow that profile to be used with the new device. From here, you can also set other parameters for your network, as well as extract the wireless password in plaintext if need be.


If you're more adventurous and want to (ab)use the command line, connection profiles are all stored in /etc/NetworkManager/system-connections, which contains (roughly) the same information as the GUI does:

[connection]
id=[Human-Friendly Connection Name]
uuid=[Connection ID]
type=wifi
permissions=user:kazwolfe:;
secondaries=
timestamp=1482791037

[wifi]
mac-address=[Device MAC]
mac-address-blacklist=
mac-address-randomization=0
mode=infrastructure
seen-bssids=[List of known BSSIDs]
ssid=[Network SSID]

[wifi-security]
group=
key-mgmt=wpa-psk
pairwise=
proto=
psk=[Network Password]

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
ip6-privacy=2
method=auto

Note that these files are owned by root because they contain sensitive information, and as such, sudo is required to be able to access or edit them. Also note that while the filenames in this path are usually the SSID, this is not a hard-and-fast rule. Therefore, you might need to do a bit of poking around to find your network.

1
  • Great info! Thanks, this finally makes sense :)
    – user999
    Dec 28, 2016 at 20:26
5

To find the saved wifi password via command line, follow these steps: Login into Ubuntu and open up the “Terminal” and enter these commands.

$ cd /etc/NetworkManager/system-connections/

$ ls -a

Now you will get name of the wifi networks saved on your pc. Now enter the following command with the name of your wifi network you want to find the password. You can find your password at “psk”=“PASSWORD”.

$ sudo cat WIFI_SSID_Name 

Source: http://www.idiotinside.com/2015/02/16/how-to-find-saved-wifi-password-via-command-line-in-ubuntu/

Not the answer you're looking for? Browse other questions tagged or ask your own question.