Featured image of post Transfer network-manager connections to new computer

Transfer network-manager connections to new computer

Update 2021-12-31: There is a newer blog post about this topic available.

I just recently got a new Laptop (Lenovo t440p) for testing. This might become my new companion - The old x220 is still a nice one, but I kind of need a bit more horsepower on my daily driver.

Let me tell you something about the magic of Linux - I just removed the old SSD from my x220 and put it into the t440p. It booted out of the box, with all my configurations and everything in place. No need to reconfigure or even reinstall anything. I could be productive in a couple of minutes. Also transferring the SSD was a matter of some screws, so no problem at all. That’s how it should be. That’s one of the reasons, why soldered-in SSD suck so badly.

So, everything was working nicely, except for some reason NetworkManager seemed to have forgotten all the wifi connections. Except, they were still there and configured, just for the wifi interface of the other laptop. And reconfiguring all of them is kind of boring. There has to be a better way

# NetworkManager & System connection

NetworkManager stores all the connections in /etc/NetworkManager/system-connections. They are there as plaintext files (restricted to root through)

Turns out, the line we need to change in every file is the following


This is the mac-address of my old laptop, and I just need to replace it with the MAC of my new laptop. Easy as goo pie. The following one-liner does the job. Remember to replace YY:YY:YY:YY:YY:YY with the MAC address of your laptop

for i in *; do sed -i 's/mac-address=XX:XX:XX:XX:XX:XX/mac-address=YY:YY:YY:YY:YY:YY/' $i; done

After that, I restarted NetworkManager, and it was nicely connecting to my wifi.


  • NetworkManager wifi-connections are MAC-sensitive
  • To bring your connections to a new wifi adapter you need to change the mac-address line of every connection

Modify and use the following script to automate the mac change



cd /etc/NetworkManager/system-connections
for i in *; do sed -i "s/mac-address=${OLD_MAC}/mac-address=${NEW_MAC}/" $i; done