Configuring device id

I run Syncthing on a headless Raspberry Pi under Raspbian (Debian for Pi) Jessie.

All folders to sync are on an external disk. Configuration files are on the boot sd card.

I couldn’t boot the sdcard recently, so I rebuilt it from scratch. This isn’t too difficult; I’ve done it before.

I’ve created the st user, installed from the package and run st with the generate option.

I’m about to run in earnest for the first time this build.

Last time I rebuilt, I had to remove and add the folders at my other nodes, and I think that there may have been a little bit too much syncing.

  1. Can I edit config.xml to change the device-id to its previous value (which I can copy and paste from another node via the webgui)?

  2. Is it safe to remove the default folder from config.xml?

Thanks

  1. no. You need the old certificate (cert.pem and key.pem located in ~/.config/syncthing) to be able to reuse the old ID. Without that, the other devices will refuse to connect (as they should) because the certificates do not match.

  2. afaik, yes

1 Like

Thanks @wweich

Lets hope I have a copy somewhere (I don’t know yet).

Anyway, I’ll make sure I have them handy for the next build.

confirmed

I looks like cert.pem and key.pem were generated when I ran with the configure option.

When I ran for real https-cert.pem and https-key.pem were generated.

I think I might have been on 0.11.20 to configure and on 0.11.22 when starting and enabling the service.

Just wondered why…

Yeah, the keys are generated either on first startup (because they’re needed) or when you run with -generate to force it. The HTTPS keys are generated when needed (again, first startup).

I’m trying to automate the installation and setup of syncthing in multiple servers. Is there a way to generate device IDs so I can put in ansible templates?

Well -generate pregenerates the config/certs etc, and device ID is derived from the certs.

2 Likes