preserve file ownership on sync


crdb
 Share

Recommended Posts

it is unclear to me how Sync should behave.

I sync between Windows and linux. Btsync starts as a service using upstart and is ran as root. Therefore, all the files are owned by root and I have to chown to edit them. Perhaps an option can be set in the folder config (I think Samba does this) or it can default to the owner of the directory you're syncing to.

Link to comment
Share on other sites

I sync between Windows and linux. Btsync starts as a service using upstart and is ran as root. Therefore, all the files are owned by root and I have to chown to edit them. Perhaps an option can be set in the folder config (I think Samba does this) or it can default to the owner of the directory you're syncing to.

I sync between different linux machines & one Windows machine, and this sounds like a good solution to me. My main computer is running linux, and it's very annoying to have to chown my own files when i want to edit one that has been synced. So, on a per-folder-shared basis you can set it to be a *specific* user, or the owner of the dir you're syncing into. Thanks andrewbootlegger!!

Link to comment
Share on other sites

I don't have any Linux knowledge but in my two Linux machines I do start BTSync as a user. That helped me to get past annoying permission problems between my Windows and Linux machines. I found this solution somewhere in the forum here:


sudo -u your_user /boot/custom/btsync --config /boot/custom/btsync.conf

Link to comment
Share on other sites

Hi everyone, new here.

I've got an issue related to this. I followed this great tutorial on how to keep my files not only synchronized between computers by means of BTSync but also available via the web interface of the ownCloud software. The problem is, Sync needs the folder it works on to be owned by the user that started the sync process (in my case the user 'pi' off the group 'users'), while ownCloud is a web service based on nginx web server, which I'm quite sure runs under the 'www-data' user which only belongs to the 'www-data' user group.

So everytime I change the permission ownership for my shared folder to the 'pi' user or to the entire 'users' group, BTSync is able to synchronize the files in that folder, but the ownCloud gui doesnt show the content of it and says "You don't have write permissions here"; while if I change ownership of that folder to either the 'www-data' group or its sole member the 'www-data' user, now ownCloud is happy to let me see, download and upload files from it but suddenly BTSync is not able to synch it with my other computers and its web UI says it "Can't open the destination folder" (be careful I know it's not the same situation addressed in the unofficial FAQ's for this error message).

It's a mystery why this didn't happen to the dev who posted that tutorial. Maybe it's because his shared folder is on an external mounted drive and mine is not?

Anyways, I'm quite sure I could solve this by creating a new group ('btsyncandowncloudusers" would be a good name) and adding both www-data and 'pi' who started BTSync to it, then changing permission to the shared folder so it is owned by this new group. Is this the best way to solve the problem? Or shoud I add pi to the www-data group or the www-data user to the users group and add set ownership of the folder to either of the groups? Or is a better idea (probably not) to log into www-data user and run BTSync from it then let just that user to be the owner of the shared folder?

TIA, hope I was clear enough-

Link to comment
Share on other sites

  • 3 weeks later...

Hi everyone, new here.

I've got an issue related to this. I followed this great tutorial on how to keep my files not only synchronized between computers by means of BTSync but also available via the web interface of the ownCloud software. The problem is, Sync needs the folder it works on to be owned by the user that started the sync process (in my case the user 'pi' off the group 'users'), while ownCloud is a web service based on nginx web server, which I'm quite sure runs under the 'www-data' user which only belongs to the 'www-data' user group.

So everytime I change the permission ownership for my shared folder to the 'pi' user or to the entire 'users' group, BTSync is able to synchronize the files in that folder, but the ownCloud gui doesnt show the content of it and says "You don't have write permissions here"; while if I change ownership of that folder to either the 'www-data' group or its sole member the 'www-data' user, now ownCloud is happy to let me see, download and upload files from it but suddenly BTSync is not able to synch it with my other computers and its web UI says it "Can't open the destination folder" (be careful I know it's not the same situation addressed in the unofficial FAQ's for this error message).

It's a mystery why this didn't happen to the dev who posted that tutorial. Maybe it's because his shared folder is on an external mounted drive and mine is not?

IMHO it seems they haven't tested ownCloud + BTSync long enough. Anyway, both have not been designed to work togheter, so issues seem legit.

I've tested the same coupling and I've exactly the same problem. In Raspbian, I've installed it using apt repos. Renaming the config file in `/etc/btsync` as `conf.pi.www-data.conf` will run the BTSync process as user `pi` and group 'www-data`.

I've also added user `pi` to `www-data` group. Now I'm able to:

* read, write, move folders/files from ownCloud web interface

* sync anything

* create files from a webdav client (android)

I'm not able to:

* move files/folders using webdav client (android)

* move files/folders created from webdav client using ownCloud web interface

Anyways, I'm quite sure I could solve this by creating a new group ('btsyncandowncloudusers" would be a good name) and adding both www-data and 'pi' who started BTSync to it, then changing permission to the shared folder so it is owned by this new group. Is this the best way to solve the problem? Or shoud I add pi to the www-data group or the www-data user to the users group and add set ownership of the folder to either of the groups? Or is a better idea (probably not) to log into www-data user and run BTSync from it then let just that user to be the owner of the shared folder?

Creating a dedicated group sounds like an interesting solution, have you tried it?

Link to comment
Share on other sites

  • 1 month later...

I also followed the owncloud/btsync setup for the raspberry. I use the following autostart script to launch btsync:


#! /bin/sh
# /etc/init.d/btsync
#
# Carry out specific functions when asked to by the system
case "$1" in
start)
start-stop-daemon -c www-data:www-data --start -x /home/pi/.btsync/btsync
;;
stop)
killall btsync
;;
*)
echo "Usage: /etc/init.d/btsync {start|stop}"
exit 1
;;
esac
exit 0

This starts the service as user www-data and group www-data, the executable is at /home/pi/.btsync/btsync

It still doesn't preserve the permissions (somehow I'm getting 644), but it's close enough. Would be great if a default umask could be set somewhere. Right now I just have a cron-job keeping the permissions intact.

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.

 Share