How to export and migrate NetworkManager settings to new system?

Use cases are:

  • reinstalling a machine
  • moving network configuration from laptop to desktop system (or vice-versa)

All settings should be migrated, that includes:

  • default and custom network connections
  • wifi connections with passwords
  • VLAN configurations
  • VPN configurations (with keys if possible)

I checked on Arch wiki and it there is nothing on migration, so I'm asking you guys and gals here.

7 Answers 7


Each connection configured in NetworkManager is stored in a file in


Usually, you can copy needed files from a machine to another (by root, of course).

Warning: some configuration file could reference external resources. E.g. in one of my openvpn files I have a line like cert=/home/andcoz/somedir/somefile.crt. You need to copy any referred file.

Warning 2: passwords will NOT be on those files by default. see docs. Instead lines such as private-key-flags=1, it means the password is saved in your secret agent (for example kde wallet). In most GUI clients, this is controlled by the drop down under each password "Store password for this user only (encrypted)". If you change to the other value, the -flags value will change to 0 and passwords will be on those files (which are read by root only).

  • 13
    This answer is incomplete. NetworkManager assigns a UUID to each system connection that appears to be based on the MAC address of the interface. If you change hardware, NetworkManager won't use old system connections because the UUID no longer matches what it expects. Jul 12, 2017 at 13:30
  • I checked directory /etc/NetworkManager/system-connections on my laptop and I only see vpn connections there. But I don't see any wired or wifi settings there. I'll try moving over one vpn connection and report back if this works or not. So if it works this answers 1/4 of the question. Thanks.
    – valentt
    Oct 27, 2017 at 8:00
  • 3
    @divestoclimb is there some guide that explains how to rename UUID from old system to new one's ?
    – valentt
    Oct 27, 2017 at 8:01
  • 1
    @divestoclimb is right, these connections won't be picked up if you migrate to new hardware, only for a reinstall on the same hardware this will work. I'd love to know a solution here, just like valentt!
    – djvdorp
    Apr 25, 2018 at 16:57
  • 2
    The UUID is only a random generated identifier. You have to be sure that each connection has a unique identifier (on each machine).
    – andcoz
    Apr 30, 2018 at 13:08

As mentioned by others, Wi-Fi connection files in system-connections directory have the interface MAC address included. This need to match your current setup hence the procedure is:

  1. copy all files from old machine to new machine from/to directory:

  2. change MAC address entry in each file from old MAC to new MAC. As root:

    cd /etc/NetworkManager/system-connections
    sed -i -e 's/<old mac>/<new mac>/ *
  3. Just in case, restart network manager:

    systemctl restart NetworkManager

Old mac you may check from any of the files you copied, new mac if unsure you can check with ip link (or from the file that likely got created when you installed your system for the connection you used to copy the files).

Note: above assumes you had a single Wi-Fi interface in both your old an new setup, but the same logic should work with multiple interfaces.

  • 2
    What is the line of MAC for VPN conf files? I only see UUID. How can I re-generate new UUID on a new machine?
    – 32r34wgf3e
    Aug 1, 2018 at 17:48
  • In Arch based distro case, restart NetworkManager solves saved network list problem
    – maxemilian
    Nov 1, 2023 at 5:33

The following worked for me on ubuntu:20.10

Copy the contents of /etc/NetworkManager/system-connections over.

Make sure that the permissions=user:newusername:; matches your running user (the one under which you want to use the vpn - echo $( whoami ) can help)

Next make sure you have the correct packages installed. If you are using openvpn then you need


You will also need the correct service-type packages installed. For example when using service-type=org.freedesktop.NetworkManager.l2tp Then you will need to install l2tp for network manager

And finally what I had problem with is permissions on the files in /etc/NetworkManager/system-connections For me, the files need these permissions:

-rw------- 1 root root

When I copied the files I had 775 permissions with my user as owner on them which prevented NetworkManager from using them for some reason.

  • 1
    THIS is the complete answer Jul 7, 2021 at 15:09
  • 1
    I'm afraid it's not complete either. It misses external files (keys and certs), passwords stored elsewhere, MAC/UUIDs not matching... the list is still probably incomplete.
    – Eusebius
    Sep 15, 2021 at 11:10

Wireless settings (at least on Fedora) are kept in this directory:


There are two files per wifi connection. First file is named ifcfg-YOURSSID contains wifi network settings and keys-YOURSSID contains wireless network password.

Also there is a related question that explains this: Where are NetworkManager's WiFi settings stored?


It took me too long to figure this out, but you can export individual things (like VPN settings) using nmcli:

# List connections
nmcli connection

# Export one
nmcli connection export ConnectionName > yourfile

This works no matter where your config files are, though I think there's no way to export more than one at a time. Unfortunately this doesn't appear to retain at least password credentials - it may retain certificate ones.

  • Usage: nmcli connection export { ARGUMENTS | help } ARGUMENTS := [id | uuid | path] <ID> [<output file>] Export a connection. Only VPN connections are supported at the moment. The data are directed to standard output or to a file if a name is given. (This at least for Centos/rocky 8.4) Aug 2, 2021 at 21:33
  • It doesn't do much, only grabs what is in system-connections. For OpenVPN connections in particular, keys and certs are left out so it is basically useless.
    – Eusebius
    Sep 15, 2021 at 11:12
  • This worked perfectly for me. I don't need all the certs, those all get setup again when I do the initial authentication. I just needed the general config to satisfy the "Import from file..."
    – Randoogle
    Apr 11 at 17:01

The other posts are right, but there are minor changes to some points.
The answers are kept in


You can remove the line mac-address or change it via

cd /etc/NetworkManager/system-connections
sed -i -e 's/<old mac>/<new mac>/' *

You can get the new mac adress via

ip a

Depending on the storage where You kept the files, the file rights may be wrong, just set them via:

chmod 0600 *
chown root:root *

Finally restart Network Manager

systemctl restart NetworkManager

Works the same under ubuntu 18.04.


Use the connection show interface name and redirect to a file. First run con show to get the name/UUID

nmcli con show 
nmcli con show eth0 > yourfile

You must log in to answer this question.

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