Qnap & File Permissions (Can Not Resolve Using 'normal' Methods)


Recommended Posts

Hello

 

QNAP Model: TS-809U

Firmware version: 4.1.0

Bittorrent Sync verison: 1.3.109

Linux version: 3.4.6 (root@NasX86-13) (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)) #1

 

Normally, by default, Bittorrent Sync runs on linux as the user: “root” and group: “administrators” and writes these owner:group permissions to syncronized files and folder that it creates.

 

In the case of the QNAP NAS, Bittorrent Sync writes files and runs as the user “admin”.

 

I have successfully managed to enforce all sub-folders and files in my sync folder to inherit the group “btsync” in the file permissions by using:

chown admin:btsync /syncchmod g+s /sync

The problem is that Bittorrent Sync creates new files and folders with read-only permissions for the group “bysync” (i.e. wxr-xr-x / octal 0755).

 

From researching I have found that the 2 ways to change this normally would be:

 

1) Add this line to the btsync.conf file and restart btsync:

// DAEMON_UMASK=002

2) Use the following command and when prompted enter "002" as the umask

dpkg-reconfigure btsync

Neither of the 2 above methods resolve the issue. In the case of item 1, this setting seems to be ignored by btsync. With item 2, “dpkg-reconfigure” is not a command available on the version of linux used by the QNAP NAS.

 

Thank you in advance for your help!

 

Link to comment
Share on other sites

Hello

 

QNAP Model: TS-809U

Firmware version: 4.1.0

Bittorrent Sync verison: 1.3.109

Linux version: 3.4.6 (root@NasX86-13) (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)) #1

 

....

 

From researching I have found that the 2 ways to change this normally would be:

 

1) Add this line to the btsync.conf file and restart btsync:

// DAEMON_UMASK=002

2) Use the following command and when prompted enter "002" as the umask

dpkg-reconfigure btsync

Neither of the 2 above methods resolve the issue. In the case of item 1, this setting seems to be ignored by btsync. With item 2, “dpkg-reconfigure” is not a command available on the version of linux used by the QNAP NAS.

 

Thank you in advance for your help!

 

The command and the configuration file setting will not work in your case. I suppose you took your information from the thread Debian And Ubuntu Server Unofficial Packages For Bittorrent Sync. All information in that thread is only related to the Debian/Ubuntu packages. Since your system is a QNAP NAS, I'm quite sure that you are using the btsync QPKG that is totally different from the Debian/Ubuntu package (that is not compatible with the QNAP OS and IMHO there is no way to install it on QOS).

Link to comment
Share on other sites

Hi RomanZ

 

Sorry for the confusion!.. I made a mistake....

 

I am running Bittorrent Sync on PCs and Macs also and they are all version 1.3.109. The version I am running on the QNAP is the QPKG standard installation and yes you are correct, I just double-checked and it is 1.3.106

 

Thanks

Link to comment
Share on other sites

teoky,

 

I am not sure what you are trying to accomplish with the group "btsync". This is not a user or group created by the official BitTorrent QNAP package. Are you following some how-to/tutorial?

 

On QNAP we run Sync under the "admin" user and so all files/folders will be owned by "admin". I am not aware of any way to change the default permissions for new files.

 

What are you trying to accomplish? This way we may investigate other solutions.

Link to comment
Share on other sites

Hi Richard

 

I'm just trying to give users of the NAS read/write access to the syncronised files.

 

Currently, if a file/folder is created on a PC or MAC which is running btsync, these files/folders are added to the QNAP NAS so that only the user "admin" has read/write access. Other users access this NAS as via network shares and can not edit anything created on the NAS by btsync (except for the user "admin")

 

The group "bysync" is just an example. On the QNAP NAS, groups can be created (i.e. "department_a", "department_b", etc..) and users can be added to that group. We actually have several shared folders which bysync now sycronises across different physical sites.

 

I have successfully managed to make files/folders created by btsync inherit the group permissions from the share's parent folder. The problem is that the group only has read permission and this needs to be read/write. I can't have all users logging on to the NAS' network share as the user "admin".

 

Thanks

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

We are currently using BTSync 1.3, but we will test tomorrow with version 1.4

We have a number of Synology devices at work and are lucky enough to have V1.3 for our production environment and V1.4 for our test environment.

Due to the criticality and remote location of our production devices, we've decided to wait until version 1.4 matures a little and will consider upgrading around Christmas time when we recall the devices for maintenance and upgrades, during the shutdown.

All devices are running DSM5 (latest update).

We are using

1x RS3614XS+

2x DS421+

All 3 devices are on the same network and part of a windows active directory.

Please let me know if there is any further information required? I will test version 1.4 first thing tomorrow morning and will let you know our findings.

Adam

Link to comment
Share on other sites

We are testing V1.4 now, but wanted to update with 1.3 incase its an obvious the problem still exists in 1.4.

 

The left side is the original file on the RS3614XS+ and the right side if the newly created file on the DS421+

 

It seems to have taken permission of the file, and not applied the same file permissions after sync;

 

A6HfJT.jpg

Link to comment
Share on other sites

@adam1v

 

As to your permissions issue - it is the design. Permissions (and owning users as well) are not transferred by Sync. Sync runs under some user. When Sync receives new file - it creates a file with the user and user group which actually running the process as owner and sets permission according to umask.

Link to comment
Share on other sites

@RomanZ

 

In the case of a QNAP NAS,...

 

There doesn't appear to be a way to change the owner of the btsync process. Therefore users can not edit edit files and folders created by btsync because the users are not "Admin".

 

There also appears to be no way to make btsync write with the correct UMASK to allow for the "group" to read/write.

 

Thanks

Link to comment
Share on other sites

@adam1v

Am I able to SSH into a QNAP NAS and modify the user of the btsync process? While I agree this this is not a solution, this would at least be a work around for me for now. I can not seem to find a way to do this. Actually, even if I could just set btsync to write the correct UMASK would be a workaround for now.

 

I think the solution should be that the files and folders inherit the permissions of the parent directory. This is how it appears to work on the Windows and OS X versions.

 

Thanks

Link to comment
Share on other sites

I have exatcly the same issue with a new SEAGATE NAS 2BAY. The BitTorrent Sync was installed directly by the App Center on the NAS.

The daemon runs with root privileges and writes new folders and files with the same permissions. However, the group owner assigned to the files seems to be equal to that of the parent folder. In my configuration it would be sufficient to set automatically the group mask in RW in order to modify the files from other sources.

 

Thanks.

Link to comment
Share on other sites

  • 3 weeks later...

It's been a bit of a nightmare, but I finally got this sorted on my two QNAP TS-421

 

Two step process:

 

1. I had to ssh in and edit the startup script: /etc/init.d/btsync.sh (which just links to /share/MD0_DATA/.qpkg/BitTorrentSync/btsync.sh

 

and add the line:

 

umask 002

 

somewhere near the beginning. I added it just before the "case".

 

Note: it seems extremely likely that if you update the package you will need to redo this step!

 

2. Make sure that all your existing files and directories have sufficient privileges and the correct ownership. From the top level share (/share/MD0_DATA/<folder>):

 

chgrp -R everyone * <--- make sure all the existing files and folders belong to the group "everyone"

chmod -R 775 * <--- make sure all that the group has full permissions (this is what the umask above takes care of for new files and directories).

chmod -R g+s * <--- set the "sgid" bit which forces new files and directories to inherit the group ownership.

 

 

----

 

One additional thing that was weird and frustrating while trying to test stuff; while logged in as admin the sgid bit was not being inherited by directories that I manually created. (!!) So you'd create be in a directory; create a new subdirectory---it would have the correct group but NOT the sgid which it should also inherit. Then you'd create a new file in the subdirectory and it would NOT have the correct group. Fortunately, it seems that btsync still runs OK and sets it correctly.

Link to comment
Share on other sites

It's been a bit of a nightmare, but I finally got this sorted on my two QNAP TS-421

Two step process:

1. I had to ssh in and edit the startup script: /etc/init.d/btsync.sh (which just links to /share/MD0_DATA/.qpkg/BitTorrentSync/btsync.sh

and add the line:

umask 002

somewhere near the beginning. I added it just before the "case".

Note: it seems extremely likely that if you update the package you will need to redo this step!

2. Make sure that all your existing files and directories have sufficient privileges and the correct ownership. From the top level share (/share/MD0_DATA/):

chgrp -R everyone * <--- make sure all the existing files and folders belong to the group "everyone"

chmod -R 775 * <--- make sure all that the group has full permissions (this is what the umask above takes care of for new files and directories).

chmod -R g+s * <--- set the "sgid" bit which forces new files and directories to inherit the group ownership.

----

One additional thing that was weird and frustrating while trying to test stuff; while logged in as admin the sgid bit was not being inherited by directories that I manually created. (!!) So you'd create be in a directory; create a new subdirectory---it would have the correct group but NOT the sgid which it should also inherit. Then you'd create a new file in the subdirectory and it would NOT have the correct group. Fortunately, it seems that btsync still runs OK and sets it correctly.

Thanks, I try...

Link to comment
Share on other sites

Has anyone figured this out? I am running btsync on a Synology NAS with several users who cannot save to folders created by btsync. Very frustrating.  I added // DAEMON_UMASK=002 to btsync.conf and it changed nothing.  Any other versions of this change to btsync.conf caused btsync to refuse to run.

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.