First run of syncthing: re-use an old DeviceID

I use Syncthing on containers provided by a not-so-expensive GPU cloud hosting. The major drawback is that these containers have a short lifetime. So I frequently have to destroy a container and rebuild a new one. (Not possible to download it right now).

Problem: each time I rebuild a new container, I have a new ST DeviceID, so I have to redo the config on the container + redo the config on my local machine (add the new DeviceID to my local machine, re-share the folder to this new DeviceID), etc.

All would be simplified if on the first run of ./syncthing I could specify “Please reuse this existing DeviceID”:

./syncthing deviceid=ABCDEFG...XYZ

(there will never be a conflict between the 2 devices because when I do this on the new container, the old one is destroyed).

The gain would be that:

  • I wouldn’t have to add a new DevideID on my local computer’s ST
  • I woulnd’t have to re-share the local folder to a new device
  • If the new container has the same DeviceID, then he will automatically discover “DeviceHomeComputer wants to share this folder with you, do you accept?” and I would just have to press Yes.

How to do this?

Save the config.xml, cert.pem and key.pem files from the config directory. It’s not possible to “become” an existing device ID without those files - if it were, you could impersonate anyone.

1 Like

Ok so just these 3 files and it will be ok?

Should I:

  1. Copy these 3 files in the config directory of the new container and then do the first launch of ./syncthing


  1. Do the first launch of ./syncthing, and then copy these 3 files in the config directory of the new container?

Thanks @calmh

Those files, yes. Before first launch. Or after, it doesn’t matter, but then you’ll overwrite the ones that have been created at first launch and have to restart Syncthing.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.