this post was submitted on 01 May 2024
54 points (85.5% liked)

Selfhosted

40173 readers
638 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Just installed Syncthing on my Scale server. It looks like it doesn't have users but rather folder IDs that are then used to sync devices. One of the cool features of Nextcloud is the ability to share files with other users. Can this be done with Syncthing?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 10 points 6 months ago (1 children)

You create a folder on one device and share it with other device. Both can edit files if you set the folder type as "Send & Receive". If you edit the same file at the same time you will end up with 2 copies

[–] [email protected] 2 points 6 months ago (2 children)

Its an unlikely event that both would be editing the same file at the same time. I think I've achieved this. Been messing with Syncthing today. we each have a "shared" folder on our phones and the server has one too. I selected to share with both devices.

The trick now is when you have a PC with multiple users that want to share that "shared" folder. I need to work that one out ... :-)

[–] [email protected] 2 points 6 months ago* (last edited 6 months ago) (1 children)

Here one crucial element that needs to be highlighted is Syncthing is decentralised by design. I mean it is different from a server-client way of thinking. It is very much like how git stores content, if you are familiar with it.

For example, let us say I have 5 devices and there is a folder I want in all my devices kept in sync. Since there is no server, to propagate updates made in one device (let us call it Source Device) to other devices, it has to happen either directly, or indirectly. Here I'm assuming all 5 devices are configured to communicate with each other directly.

Whenever one of the other 4 devices (Device 1) becomes 'online' at the same time as of Source Device, the sync will happen. This is the direct way. The indirect one is, let us say after the sync happened between Source Device and Device 1, the Source Device goes 'offline', but the Device 1 continues to be 'online', now if Device 2 comes online, the change will be propagated from Device 1 to Device 2.

Note that the assumption, one device configired with all other devices is not the case, propagation of change has to take a path that similar to indirect way, even if all the devices are simultaneously online.

This configuration, where each device is configured to communicate with all other, is a pain to maintain, since Syncthing is not designed like a publish-subscribe model. What people usually do is, an always-on device (usually a server) is used as one of the devices that need to be kept in sync. Again, this is not a client server model, but each device is a 'node', and the always-on device is also just another node.

As you already experienced, it is very easy to get sync conflicts, if a folder is shared between multiple users, because of this decentralised design. In my opinion Syncthing works best for a single user. My use cases are, syncing my notes between pc and mobile, sync files scanned with the mobile to my pc, etc.

If your case is more focused on multiple users, WebDAV server can be an option. But again it's not straight forward and may not cover all use cases. Depending on what you are trying to achieve, a tool more suitable might be available. For example, if the aim is collaborative development there is Iroh (Still in early stages of development)

I hope this helps.

[–] [email protected] 2 points 6 months ago (1 children)

I actually do have an always on server and I was planning on using it as a client-server type system. I think that the file sharing option is complicated to implement. I tried to launch syncthing in my wifes environment on the laptop and while I get a new ID, when I register it with the server, it complains saying that there are conflicts with the IDs for the device. I wonder if its getting confused by having two IDs against the same IP

[–] [email protected] 2 points 6 months ago (1 children)

IP should not cause any issues. IDs are just a hash of certificate used by Syncthing. Can you elaborate a little on the current setup? Device, OS, User, etc. Also if possible can you explain your use case? As I mentioned, Syncthing is very specific to what it can do, so it may not be the best solution for your case.

[–] [email protected] 1 points 6 months ago (1 children)

Server is Truenas Scale. Syncthing is running as app. I and wife have it installed on Android phones. We both share a Debian 12 laptop with different logins. We both want to keep respective phone synced with laptop login. We want to have a folder shared on nas where we can exchange files.

[–] [email protected] 2 points 6 months ago (1 children)

One thing you can try out, if you haven't done already, is configuring 2 different ports for the two users here. GUI has an option to adjust the ports, also you can configure two different services to start depending on the logged in user. I haven't done it myself on Linux, but it looks like people had success. One R*ddit thread for example,

Syncthing on a multi user Computer

[–] [email protected] 2 points 6 months ago* (last edited 6 months ago)

Thanks. I'll give this a try over the weekend since it appears to have worked for others. This is something I would have expected the developers to have implemented. Multiuser computers is not that rare ...

[–] [email protected] 2 points 6 months ago* (last edited 6 months ago)

Oh forgot to add that the last case that you mentioned, where multiple users sharing a PC, and keeping the folder in sync with all, is not straightforward. This needs another always-on (server like) device.

At least in Windows each user gets a different Syncthing ID. So if you sync the file with an always-on device, the other user can get the update when they come online from that.