Files Synced Down As "ROOT" user.


Recommended Posts

I am running two Ubuntu 13.04 systems.

Everything seems to be syncing properly between the two machines.

The only issue I am having now is when my second machine goes and gets the files, it pulls them down and sets the permissions of the file as ... owner = root and group = root.

Is there anyway to configure my BT Sync setup so when it pulls down the files it won't change the file permissions to root:root ?

Link to comment
Share on other sites

As it's a network server it's not the best idea to run btsync as root. It doesn't use anything that requires root access.

Specifically, BTSync does not (as yet) understand users so will create all files as the user that it's run, it cannot change the user ID.

So you need to run BTSync as the user & group that you want the files to have. (Don't forget to set your umask too).

Link to comment
Share on other sites

That makes sense.

I used this post to add the repository and install BTSync ... http://forum.bittorrent.com/topic/18974-debian-and-ubuntu-server-packages-for-bittorrent-sync/ So, I installed and configured BTSync using sudo or "root".

Seems like the package/installation, from the link above, setup my BTSync configuration to auto-start when the computer loads (probably as root because I used that to install it). Do you know of a configuration file, and where it is located, that I could manually go in and change the user id that starts BTSync?

Or do you recommend doing a apt-get remove and installing it again without sudo?

Link to comment
Share on other sites

You should let your initscript fix this issue. I have one like https://gist.github.com/MendelGusmao/5398362 which starts a btsync process for each user in a given list and uses ~/.sync/config.json . There are many ways for root to start a process as a user, initscrips fpr debian usually use start-stop-daemon.

"apt-get only works as root" is (almost)true on the one hand but utterly unrelated. Even if you don't use any initscript at all you can simply run the "apt-get installed" program as user.

Take care, "@reboot" is not supported by all cron daemons, check your local manpage.

Link to comment
Share on other sites

Hey Guys! Please read the doc. With the server packages, you have the option to create many BTsync instances running under specific user credentials. The default instance created by the server packages always runs as root but you can create additional or alternative instances (if you do not let debconf create a default instance -> first question) running under different credentials.

Read the doc.

Read the doc.

READ THE DOC.


less /usr/share/doc/btsync/README.Debian

btsync for Debian
-----------------

This version of BitTorrent Sync is mainly intended for server usage.
It allows to start one or more BitTorrent Sync daemons based on
configuration files located in /etc/btsync

Configuration parameters not parsed by btsync but by the daemon
scripts can be supplied as comments in the configuration file.

The following parameters are supported:

DAEMON_UID: A uid for supplying the user under which
the btsync daemon should run

DAEMON_GID: A gid for supplying the group under which
the btsync daemon should run. If omitted
the daemon will run under the primary group
of the user

DAEMON_UMASK: The umask for the btsync damon. If omitted
the default umask is used.

The parameter definition must use an equal sign ("="):

//
// DAEMON_UID=jdoe
// DAEMON_UMASK=0002
//

This example will launch the instance running under the credentials
of the user "jdoe" using 0002 as umask


The old mechanism using the encoding in the configuration file
name following the naming scheme

<damon name>[.<user>[.<group>]].conf

is still supported but is superseded by data supplied in the configuration
file itself. Support may be dismissed in future releases.

By specifying <user> and <group> it is possible to specify under which
credentials the daemon runs. In this case it must be assured that the
daemon is able to write into the data directory specified in the
configuration file. Some example files are provided under

/etc/btsync/samples


The file /etc/default/btsync allows to configure the way the daemon
starts:

The variable AUTOSTART defines which daemons are started automatically.
It can assume the values

none No daemon is started automatically
all (default) All daemons are started automatically
<list> Only the specified daemons are started automatically

The variable DAEMON_ARGS allows to specify additional commandline
parameters passed to the daemon.

And if you are using btsync as the only user on a desktop machine, please take in consideration installing the desktop version because it is really more suitable for your use case: the desktop version works like the windows or mac version. A btsync instance is autostarted on user login (obviously running only in the user context).


sudo apt-get install btsync-user

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.