11

I am going to write a simple replacement for Ubunutu's NetworkManager.

  1. Is there any place where the Wifi network passwords would be stored in Linux? I know about /etc/NetworkManager/nm-system-settings.conf
  2. If not, can I store them safely somewhere using some builtin OS utilities?

3 Answers 3

20

Ubuntu (and most likely many flavors of Debian) stores the information at /etc/NetworkManager/system-connections. Each of the connections has its own file entry. The files are secured with file mode 600 and owned by root.

The files in this directory are not limited to wireless connections; there are files for the wired connections, too.

2
  • Is there a standard command though, instead of getting to the file? Jun 3, 2019 at 14:57
  • No... not that I'm aware of. It's not normal to have to browse the hundreds of configuration files on the computer. The standard command interface is the GUI... to click on the network adapter and type in the password or other options for removing the connection profile (the forget option). Jun 3, 2019 at 20:12
3

There is no standard place: this depends on the wifi connection software. For instance, wicd stores them in /etc/wicd/wireless-settings.conf (which is a bad idea since the whole configuration file needs to be protected). So, I would advise you not to store the passwords with other settings that can be readable by everyone without having to become root.

8
  • Is there a standard command though that we can run, instead of getting to the file? Jun 3, 2019 at 14:57
  • @androiddeveloper Apparently not with wicd.
    – vinc17
    Jun 3, 2019 at 15:54
  • @androiddeveloper : Try, as root, cat /etc/wicd/wireless-settings.conf | grep key
    – Digger
    Jun 12, 2019 at 3:36
  • @Digger Actually I was hoping to find a solution that exists even for Android. As I've found out, on some Android versions the wifi settings file exist in one place (I think data/misc/wifi/wpa_supplicant.conf) and in one format, and starting from some Android version it changed to a different path/name (I think /data/misc/wifi/WifiConfigStore.xml) and a different format. I was hoping that if I ask here about a standard way that it works on Linux, maybe it will work on Android as well... But I think that even on Linux there is no official way to do it. Am I right? Jun 12, 2019 at 9:28
  • @androiddeveloper There is no official place, i.e. this depends on the connection utility. Since there are various utilities under Linux (mainly NetworkManager and wicd), there are various places for that. Under Android, the wifi management is provided by Android itself (via the GUI or the API), thus there is only one place.
    – vinc17
    Jun 12, 2019 at 12:45
1

The WiFi configuration file for each access point is held in the directory /etc/NetworkManager/system-connections in the case of Linux Mint. The actual password is held in a string under the section [wifi-security] as psk=[password_in_the_clear] in the respective access point config file.

Possible Trip-up: If the password begins with a 'special' character (@, #, !, etc..), then make that the password is in inverted commas, e.g. psk="[password_beginning_with_special_char]".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .