Config / path - proposing extending syntax for better portability (=> USB key!)

Hello all,

The more I use SyncThing, the more I want to install a copy on a USB key that I could use to sync and access selected, less than critical, data from any reasonably trusted computer. This without needing admin rights on said computer, as long as it allows me to run execs from the key and has Internet connectivity.

Technically, there should be no obstacle: what impersonates a device is its private key, that would reside on said USB key. There is nothing to prevent a “device” from SyncThing’s standpoint from being a USB mass storage device instead of a full fledged computer.

Still, we face the same old obstacle: the mount point (un*ces) or the drive letter (Windows) for the USB key will change with time. And the current “path” field in config.xml does not take that into account.

So what about fixing that so we could use SyncThing as a truly portable (as in mobile) solution? One idea could be to store the UUID of the medium/partition along with the path of the folder in an O.S. independent syntax, and rebuild the effective path at run time. Fstab like.

Note that this would also be a partial answer to the feature requests about multi-boot devices, as long as the syncthing conf and data folders are shared between the two (or more) OSes on the machine.

Best regards, Xavier

[EDIT] spelling

If you mean the path to folders (as opposed to the path to the config), it may help to know that it can be a relative path. So assume you have the following layout:

/Volumes/USB-stick (or wherever, this can vary)
    Files/         (these are the files you want to sync)
    Syncthing/     (this is where you keep the Syncthing config, keys and database)
    bin/           (this is where you keep binaries)

Then you can have a folder in the config as <folder id="whatever" path="Files"> and start Syncthing with the correct current directory:

$ cd /Volumes/USB-stick
$ ./bin/syncthing -home Syncthing

As you are using Windows, you could use SyncTrayzor, which has a portable version.

The config will then be inside the SyncTrayzor folder and SyncTrayzor will make sure to use that config, regardless of the drive letter / path.

But I don’t know, if it changes the paths for the synced folders.

1 Like

If it doesn’t already, it could handle it by setting current directory to its installation path and allowing relative paths as above, I think.

Thanks for the prompt answer!

Well, duh. Seems quite obvious. Should have thinked of it and tried before coming here. I feel guilty of wasting your time now. I must have been working in the security field for too long, you know. “Relative paths can be abused, beware! Beware!”

Anyway, I’ll try to make some time to try it and report back here ASAP. Time is a very precious resource for me right now, but I’ll do my best.

Best regards, Xavier

1 Like

I don’t do anything special around Syncthing’s folder paths: I just have the ability to set Syncthing’s home path to a path relative to SyncTrayzor.exe. I don’t currently set the current working directory for Syncthing (I’m not entirely sure what it will be…), but I would be happy to set this if it would be useful.

Hello all,

As I feared, it took quite some time before I could test. I just did, and I can confirm that running SyncTrayzor from a USB key, configured to sync relative paths on the same key seems to work fine. This seems to achieve my goals for now.

Now, to go further, one would need to assess whether this use of relative paths may be abused in any malevolent way. In the longer term, I’ll try to find a similar solution that would not be limited to “Windows + .NET 4.5.1” (SyncTrayzor limitation).

Best regards, Xavier