Syncthing awkwardness – the limitations of .stignore
Don’t get me wrong – I use Syncthing and in general, for what it does, it works really well.
But there’s something I’ve run into in the past which is only exacerbated when dealing with a JD system.
that is: how do you only sync certain parts of your tree to various devices?
Example from my situation: I want to share a JD system with my partner, but there are a few folders which are specific to each of our businesses which do not need to be/should not be synced to the other person’s laptop.
Another example: I only want a few folders from my JD system on my phone, the whole thing takes up too much space. (this is not specific to JD – the same could apply with a photo or music collection, for example).
Sync each folder seperately
One solution is to make each category or even ID folder its own Syncthing folder. You can then select, on each folder, which devices it gets synced to.
For categories I can kind of see that working … but at the ID level? you’d have up to 10,000 folders if you stuck to classic 10.10.100 JD … not feasible.
I think a mix of syncing areas and categories might be realistic. But managing it might become confusing.
Limitations of the .stignore file
then there’s the .stignore
file. Which seems like it would be the way to do this, but there are issues.
The Syncthing documentation says the .stignore
file is for controlling sync ‘to (or from) other devices’. Sounds good, but … ‘other devices’ means all other devices are treated as one. What that means: you only have one on/off switch for all outgoing/incoming data. You can’t say:
#in .stignore on laptopA
*.git #applies to all devices
[laptopB] #applies to laptopB
19.22 #sensitive client files
[phone] #applies to phone
45 #full of big archives
I am, personally, rather surprised that this a) is not possible, and b) doesn’t come up in my extensive searching through online discussions. It seems to me like the most obvious thing …
EDIT the problem is more or less the same as what people are talking about when they ask for ‘selective sync’ and point to other services like Dropbox or Rsilio which sync a pointer file to be downloaded on user request from the GUI. that, however, is GUI based and is also controlled from the receiving end – see next section.
A solution – .stignore on the receiving device
there is a way to make this work. It is, unfortunately, not secure, strictly speaking. Whether that’s a problem kind of depends.
The solution is to put .stignore
files on the devices where you want to exclude stuff. So on laptopB
you could put 19.22
and on phone
you could put 45
and these devices won’t download stuff that matches those patterns.
This solves the problem of storage size.
My partner and I did this in our previous shared Sync folder for mobile devices: on our phones, we ignore everything with *
and then allow a subset with !*.mob.*
so that if we rename a file with .mob.
in the name it will get synced.
This isn’t really secure, though, because if someone gains access to the device, they can remove the .stignore
file to start receiving everything. Whether that is acceptable depends on your situation. I wonder, for example, if it would strictly pass EU data protection regulation if customer data is involved. (Actually, strictly speaking, relying on the presence of an ignore file is probably not best practise anyways, even if it worked as I desire).
So I don’t actually know of a really good solution to this.
I think the best way forward might be a mix of the two methods:
.stignore
on receiving devices for non-sensitive stuff, to reduce data usage
- put sensitive data in a separate area or system and make that a separate syncthing directory.
I’d be sad about that last point, though, because it would mean creating a high-level container just for the sake of making Syncthing work well, after all my hard work at getting everything comfortably down to half a JD system.
I think I could live with activating two of my four currently unused Areas. One each for my partner and me, for sensitive business-related information. Then I would have eight folders to manage in Syncthing: six for our shared setup, and two for each of our two businesses, which would be almost empty since those are currently two categories under 00
.