Unix/Linux FIle/Folder Permissions


Recommended Posts

In the Linux builds of the application i've run into a problem with sycning files for multiple users. The SyncApp will give ownership of all synced files to the user the process was running under.

This creates a bit of a problem. If the application was say running as root (in a perfect world everyone would create a user for each new daemon application) and you have added a new `sync` it will then begin creating files and filling them with data at the pre-defined location which might by your home folder located at `/home/MagicalTux`; there is one problem with this and it's that you cant access them files and folders because ownership has being assigned to the root user (the user the process was running under).

One workaround for this problem would be to create a new user (remember what we talked about with creating a new user for each new daemon application?) with a name such as `btsync` and create a group with the exact same name as well as assign the new group as the default group of that user (useradd -b "/home/" -U -m MagicalTux) . Now that we have created a new user we can then add exsisting users into the `btsync` group so when it creates new files and folders we can then access them because we are under the same group as the `btsync` user (the user the process is running under) however there is one problem with this and its that btsync does not give group permissions beyond read and execute so we can not write to the files that have being synced.

So if we cant write to the files perhaps we could manually the change permissions?; at the point it begins to get a bit messy. We could create a cronjob that gets elevated to root, navigates to our sync directrory, and gives ownership of everything (files and folders) to the user (MagicalTux) or change the group permissions to include write access.

Ideally the SyncApp will on its own do one of three possible things to solve this issue. Change the default group permissions for files and folders to include write permissions, find who owns the sync folder and give ownership of everything inside of it to that user once sycning has completed, or spawn a child process under the user who owns the sync folder which is then responsible for sycning all files in that folder for that user.

Perhaps other people have different solutions to this problem?

Link to comment
Share on other sites

Change the default group permissions for files and folders to include write permissions...

BTSync ignores permissions.

This means it honours the umask setting and the sgid bit on directories. Though there appears to be a problem with the execute bit on 'other'.

Nevertheless, for what you want you just have to set BTSync's umask to 007 and set the group of the share to btsync and set the sgid bit on all the directories currently in the share.

.

.

.

Yes, there's a bug post-20346-0-64858000-1367139462.gif when it creates files.

The open()/creat() call sets the modes to 664 or 774 instead of 666 and 777. This means umask doesn't work completely correctly.

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.