Writeable folders in Linux


xkiter

Recommended Posts

Friends of this forum.

I believe this is a bug or lack of deep knowledge but... I exhausted all my tricks to solve it, so maybe you can help.

When installing btsync on a Ubuntu 13.04 headless, I have it sync quite fast w/ other windows machines and everything seems working ok. Problem is that I want to use the sync folders in OwnCloud setup, that makes mandatory that folders (and files) are writeable. I was able to make all the "remotely" created files (synced from remote machines) read/write by btsync (and thus also OwnCloud), but all the folders/directories created by btsync are r-x only, ie, read only and thus one can't delete them from OwnCloud.

Any suggestions on how to force btsync to rw the new folders it creates?

Thanks all for help.

Link to comment
Share on other sites

I have not been able to reproduce it, I think it might be a mask issue...

I would check /etc/login.defs, /etc/profile, and $HOME/.profile to see what your umask is set to, should be 022(rwxr-xr-x).

Also you could use setfacl to set a default mask for the folders.

Link to comment
Share on other sites

Hi xkiter

I also tried to use BTsync as the owncloud sync client instead of the original one.

The problem that accurs is this as far as I am concerned:

Go to the folder where your owncloud data folder is in (e.g. for /home/user/data)

/home/user/

and ls -l it:

drwxrwx--- 7 www-data www-data 4096 Jul 8 14:49 data

Now go to the folder that is being synced by BTsync:

/home/user/data/oc-user/files

and type ls -l.

inside that folder I have a synced folder (syncfolder) and the permissions are:

drwxr-xr-x 3 root root 4096 Jul 8 15:15 syncfolder.

That's because BTsync is running as root on my machine.

Is that the same for you?

Then we should just run BTSync as www-data as "Lighting" is proposing.

Can someone explain me how this is done? Probably not really a btsync issue, more a linux isssue...

Anyways, would be glad if someone could help!

I hope the above makes sense...

Kind Regards,

CK

Link to comment
Share on other sites

Here is some quick python I typed up, havent had time to test it properly but it looks like it should run...

It needs to be launched by root(maybe something simple like adding to /etc/rc.local), and the system needs to have python.

Filename: BTSync-launcher.py

root:root(rwx------)


#!/usr/bin/python
from subprocess import Popen, PIPE# used to open the process and to hide the output
from os import setuid# Force the process to run as the set user
from os.path import exists# Check to make sure config and bin exist
from sys import exit# early exits
from pwd import getpwnam# Used to get the uid of the given user
user = "www-data"
pathToBTSync = "/path/to/btsync"
pathToConfig = "/path/to/config"
#\
userUID = getpwnam(user)[2]# Dont touch!
def main():
if not exists(pathToBTSync) or not exists(pathToConfig):
print "Error finding %s or %s." % (pathToBTSync, pathToConfig)
exit(1)
Popen([pathToBTSync, '--config', pathToConfig], stdout=PIPE)
if __name__ == "__main__":
try:
setuid(userUID)
except OSError:
print "You do not have permission to run this as %s try running it as root!" % user
exit(1)
main()

Also in your BTSync config file make sure "pid_file" is in use and points to a folder that www-data owns and has rwx to.

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.