preserve file ownership on sync


crdb

Recommended Posts

Hello,

I've started deploying btsync on linux for an LAN only replication project.

I noted that all files synchronized get the ownership of the user running btsync.

Is there a way - i guess it would require code change - to get file ownerships preserved upon replication?

Thanks,

Link to comment
Share on other sites

I can understand that... but even keeping ACLs on windows is important - Goes with the whole attib/owner/acl whish.

As you provide binaries for different platforms, why not support *platform way of doing things*, like indeed you'd lose informations while syncing between platforms but keep them while on the same one.

Link to comment
Share on other sites

We plan to do this, but not there yet. Consider this case, you share a file with a friend, we won't be able to give the ownership user name to the file, even if both platforms are Linux.

I do see your issue, possibly storing the data else where in a 'meta-data' part of bit sync? Not part of the file itself?

That's my best bet, I'm not too good with ideas... or linux.

To get over that limiation, a simple way to do that would be a feature that enables to set the desired user/group for a share in the configuration file ?

This would also enable the ability to sync different folder for different users and keeping some sort of acl ...

This also would be an acceptable work-around, I'm currently having to run BTSync as some obscure user who has a really weird configuration (To allow it access to my local files, but, also allow it's files to be read by anyone but only executed and written to by others/etc) on my laptop so that all users can access the files.

Link to comment
Share on other sites

This is a critical feature for us. One solution would be to sync file meta data such as owner, group, permissions etc only when btsync is syncing between two like platforms (linux to linux, or windows to windows), or create a new config file option like "attempt_to_preserve_ownership_and_permissions" and then btsync does indeed sync these values when it can, but acts as it currently does in other cases such as when making a file public, or when syncing a file from linux to windows etc...

We're very excited to use this tool as it's WAY better than what we're currently using to sync large file repos between our many remote locations, but losing file permissions and ownership / group info is a deal-breaker.

Thanks!

Link to comment
Share on other sites

Can you please tell me more about use case and why it is important to you? I see too many issues with transferring file ownership in p2p environment.

I'll give you few examples:

- Linux machine doesn't have the same user in system, what Sync should do? If you will add the 3-rd Linux box, what should be uid for the file?

- You have the uid but don't have permission to change it.

- You changed uid on one Linux machine, should it be propagated to other?

I understand how this should work if you own and manage two Linux boxes. In p2p environment, different OSes and different ownership of machines it is unclear to me how Sync should behave.

I completely agree that for enterprise world this is must have feature, and we will do it.

Link to comment
Share on other sites

- Linux machine doesn't have the same user in system, what Sync should do? If you will add the 3-rd Linux box, what should be uid for the file?

It doesn't matter, you should work with uid. And file can have a unknown UID on a Linux server this shouldn't matter

- You have the uid but don't have permission to change it.

Indeed daemon should run with sufficient rights to change UIDs... Else you set the ones from the user running the daemon as default

- You changed uid on one Linux machine, should it be propagated to other?

Why not ? This is still a file modification.

As for mixed OS cases, there should be a way to detect it and use a safe default scenario...

Like you push a file from Linux to Windows, you don't worry about keeping specific rights...

Oh and for the use case:

I want to use p2p transfer to sync files around the globe between servers. End user have no concerns what is used to synchronize, but the rights files have been pushed with must be kept between servers.

Link to comment
Share on other sites

We are talking about Sync usage in enterprise world, where you control environment. My point was that for consumer world, transferring file ownership is generally a bad idea.

As I said, we will have specific functionality that we want to do for enterprise, and ownership transfer is just a part of this activity.

Link to comment
Share on other sites

I can understand that you want to have this feature only in an "Enterprise" tagged version, but i disagree with you: It's NEVER a bad idea to sync file ownerships, even in consumer world.

Anyway i can quite safely work around that behaviour with correct umask and group sticky bit settings. Now missing ACLs ;)

Link to comment
Share on other sites

For a workaround in "entreprise", we can sync first some directory then we can apply ACL using setfacl utility on Linux and apply groups permissions on folders.

Folders in the applied ACL will get the same groups rights of the parent folder.

Finally, we can make a cron job to re-apply ACL once a day (if need).

That is what I will do :) and I will test on 2-3 shared folders over samba.

Link to comment
Share on other sites

For Linux users, why aren't you using rsync over ssh? There are lots of options for handling UIDs and other things. The only thing about running rsync is that it isn't live updates like btsync.... I use rsnapshot to backup Linux machines, it does so with intervals like hourly, daily, weekly, monthly and yearly; it uses rsync to do the job -- but that's nothing like btsync.

Link to comment
Share on other sites

This feature is not implemented yet. Honestly speaking, I don't know how to implement it. Keep in mind that Sync is cross platform, so if you have file that is created by jon and synchronize it with Windows, how we should preserve the user name.

You would have to detect the operating system of the client, and if it's being transferred from Windows to (l/u)nix then you could attempt to save it as root, but that would probably require that the BTSync daemon was spawned by root.

Link to comment
Share on other sites

In my deployment concept for Linux and NAS I solve this issue by running more than one instance of BTsync, each instance running as a different user. The packages I created for Debian/Ubuntu permit to create multiple configuration files that generate an instance for each configuration file.

See this thread for information about the packages. I will bundle the deployment scripts also in a separate archive for people running other distributions.

If you are not using Ubuntu or Debian or you want only to understand how this kind of deployment works, download the btsync deployment scripts here.

Link to comment
Share on other sites

I can understand that you want to have this feature only in an "Enterprise" tagged version, but i disagree with you: It's NEVER a bad idea to sync file ownerships, even in consumer world.

Is it just me or is it painfully obvious why it's a bad idea? I'm sharing files with my friend, obviously these need to be owned by his user on his PC and by my user on my PC...

Speaking of platform-specific data (ACL) not getting lost on other platforms, http://www.nongnu.org/rdiff-backup/ has a very sexy approach.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.