AnnHashaway

[Solved] How can I change the user that btsync runs under 2.3 (Ubuntu 14.04)

Recommended Posts

I'm pulling my hair out here.

I updated to 2.3.3 to use the new encrypted folders. The set up is quite a bit different, since it doesn't appear to have the dpkg option where you can select the user it runs under.

I can get it to launch as user btsync, but cannot for the life of me get the btsync user to access the second hdd on my computer. I have added btsync to my user group that has access, added read/write privileges, everything. It won't even drill past /media/USER/ when trying to add a folder from the web gui, and manually entering a directory says it doesn't have write privileges.

I have tried editing the init.d/btsync file to run as my primary user, but it wont start.

I have also editied the btsync.service file in /lib/systemd/system to show my primary user, but it still runs under btsync user.

I have already spent way to long on this. What am I missing?

What do I need to change in order to make it run as a different user from btsync?

Edit - I followed these instructions after completely wiping all the previous BTSync files from my computer - https://blog.getsync.com/2016/02/18/official-linux-packages-for-sync-now-available/

Share this post


Link to post
Share on other sites

@AnnHashaway If you'd have the Ubuntu 15.04 and newer, you could just ask systemd to run it under your current user account. Though, this option is not supported for system v init. The only workaround here is to not to use the package and just start the btsync binary manually from your current user.

Share this post


Link to post
Share on other sites

Thank you @RomanZ! That pointed me in the right direction to get it working.

For anyone else looking at this, here is what I did:

Disclaimer - I'm not a linux expert, so use at your own risk.


1. Removed /etc/init.d/btsync to prevent auto-start

2. Created .btsync folder in user home folder

3. Created storage_path folder in .btsync folder

4. Copied /etc/btsync/user_config.json and /var/run/btsync/btsync.pid to .btsync folder

5. Edited user_config.json as follows:

{
    "listening_port" : 0,
    "storage_path" : "/home/USER/.btsync/storage_path/",
    "pid_file" : "/home/USER/.btsync/btsync.pid",
    "agree_to_EULA": "yes",

    "webui" :
    {
        "listen" : "127.0.0.1:8888"
    }
}


6. Created a crontab entry to run a script that launches btsync using the newly created user_config.json file at boot. You could skip the script and just put the following entry into the USER's crontab to start on boot:

@reboot bash /usr/bin/btsync --config /home/USER/.btsync/user_config.json


7. Finally, I removed the BTSync PPA from Settings > Software & Updates > Other Software so I can control any changes in the future.

Enjoy!

 

Edited by AnnHashaway
Added a step

Share this post


Link to post
Share on other sites
On 3/9/2016 at 4:14 PM, AnnHashaway said:

Thank you @RomanZ! That pointed me in the right direction to get it working.

For anyone else looking at this, here is what I did:

Disclaimer - I'm not a linux expert, so use at your own risk.


1. Removed /etc/init.d/btsync to prevent auto-start

2. Created .btsync folder in user home folder

3. Created storage_path folder in .btsync folder

4. Copied /etc/btsync/user_config.json and /var/run/btsync/btsync.pid to .btsync folder

5. Edited user_config.json as follows:


{
    "listening_port" : 0,
    "storage_path" : "/home/USER/.btsync/storage_path/",
    "pid_file" : "/home/USER/.btsync/btsync.pid",
    "agree_to_EULA": "yes",

    "webui" :
    {
        "listen" : "127.0.0.1:8888"
    }
}


6. Created a crontab entry to run a script that launches btsync using the newly created user_config.json file at boot. You could skip the script and just put the following entry into the USER's crontab to start on boot:


@reboot bash /usr/bin/btsync --config /home/USER/.btsync/user_config.json


7. Finally, I removed the BTSync PPA from Settings > Software & Updates > Other Software so I can control any changes in the future.

Enjoy!

 

This helped me out on Ubuntu 16.04 but I also had to remove the file

/lib/systemd/system/btsync.service

everything else worked fine.

Also instead of completely removing the ppa, I just put a hold on the package so I could at least see when updates happened

sudo apt-mark hold btsync

 

Share this post


Link to post
Share on other sites

I have had a slightly better result by just changing the user in /etc/init.d/resilio-sync in ubuntu 14 to my current user

I also had to change the ownership (chown -R) of

/var/lib/resilio-sync
/etc/resilio-sync

restarted with

sudo service resilio-sync start

and it seems to have worked

Share this post


Link to post
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.