BTSync UMASK / Default Permissions

Status
Not open for further replies.

QuillOmega0

Dabbler
Joined
Nov 23, 2014
Messages
11
For the past several hours I've been trying to setup Bittorrent Sync on my FreeNAS box.

I got it working, I can have it create shares it uploads and downloads fine. I created the btsync user in my main account to match the jail following the isntructions in http://blog.bittorrent.com/2014/02/...-freenas-with-bittorrent-sync-using-a-plugin/

However when it comes to BTSync creating files/folders under my dataset, it sets the permission as 644 for the files and folders. The user and group is btsync for these files.

The problem is I'm browsing the share as another user, and this outright prevents me from writing any files to the share that btsync creates. I have done exhaustive research and found no way of changing the umask for the btsync process to 002 which would solve my dilemma as that would set any files it creates to 664 (if I'm in the btsync group anyway).

Is there anyway I can change the umask for the daemon or even that entire jail so that any files that the btsync process creates would be writable by the group?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
don't mess with ownership/permissions of the entire jail's files. this would break your jail cause most of these are OS files.

btsync forum would better be able to help changing permissions of written files.

####

one complicated option is to change what user btsync runs as. you can set this in /etc/rc.conf.local ( btsync_user="foo" )

keep in mind you'll need to..
- change the ownership of btsync's current datadirectory (/var/db/btsync) and directories it manages.

- the user you change it to will need to exist in the btsync jail

- I'm assuming your share is cifs running on the host. the host see the files with the UID/GID of the user you created but won't match those to a user/group unless you created it on FN as well.

- finally you can set what user cifs writes files as for a specific share but I don't know of it's straight forward.

####

basically your issue is that..
* btsync manages it's files using jail users/groups.
* cifs manages its permissions with host users/groups.
* host and jail don't automatically share user/group database.
* there may or may not be an option to change btsyncs written permission levels
 

QuillOmega0

Dabbler
Joined
Nov 23, 2014
Messages
11
Yes and no.

cifs is accessing the shares with whatever username I choose, I put the username into the btsync group (which has the matching gid of the btsync group in the jail) but it just comes down to it doesn't give write permissions to any files created by btsync for the group (which doesn't make much sense considering the use case). I don't know if the UMASK can be changed at the daemon (through my research the devs just recommend running it under the user you need access to, which doesn't really work for a server situation).

Yes changing who the service runs under would fix my problem for my user account. The problem is this ruins any portability or flexability with that solution, as well as increases complexity. It's a far cleaner solution to just have the btsync daemon have a UMASK of 002 and that ay any user who is in the group also has write access to the files.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Yes and no.

cifs is accessing the shares with whatever username I choose, I put the username into the btsync group (which has the matching gid of the btsync group in the jail) but it just comes down to it doesn't give write permissions to any files created by btsync for the group (which doesn't make much sense considering the use case). I don't know if the UMASK can be changed at the daemon (through my research the devs just recommend running it under the user you need access to, which doesn't really work for a server situation).

Yes changing who the service runs under would fix my problem for my user account. The problem is this ruins any portability or flexability with that solution, as well as increases complexity. It's a far cleaner solution to just have the btsync daemon have a UMASK of 002 and that ay any user who is in the group also has write access to the files.
I see. for a multi-user environment my solution isn't complete.

how about the method of forcing cifs to write all files as a specific user for a share? authentication can be done at the cifs level, not sure if you care about this or how easy it is to get setup in freenas
 

QuillOmega0

Dabbler
Joined
Nov 23, 2014
Messages
11
I'd rather not touch the how FreeNAS addresses the cifs permissions as there aren't any issues there. I'd rather fix the problem then try to work around it. It's a shame btsync is closed source as I could just put a umask call in and that'll be that.

Would it be possible to modify the rc.d script to start the process with a different umask?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I'd rather not touch the how FreeNAS addresses the cifs permissions as there aren't any issues there. I'd rather fix the problem then try to work around it. It's a shame btsync is closed source as I could just put a umask call in and that'll be that.

Would it be possible to modify the rc.d script to start the process with a different umask?
I doubt it but you can give it a try at /usr/local/etc/rc.d/btsync
 
Status
Not open for further replies.
Top