ownCloud + Bit Torrent Sync = Dropbox Clone!

owncloudbtsync

ownCloud is a very good self hosted solution to host all your contacts, photos, documents etc. Now, ownCloud does provide its own file sync application, but I believe using BitTorrent Sync is much better solution to keep your files in sync between your local machine and your ownCloud installation.

This post won’t cover installation of ownCloud, or BitTorrent Sync (see my post here for BTSync setup) and shouldn’t take more than 5 minutes!

Update 1/9/2013 –ย Permissions have been added into this guide, so that when you configure BTSync everything should work.

1. Check your BitTorrent Sync / ownCloud setup

You should be able to access the WebUI of BitTorrent Sync on the server where ownCloud is installed by going to http://owncloudserver:8888/gui and logging in with the details you choose (for details for how to enable the webUi, see my post). You should be presented with the Web UI screen.

Now to check ownCloud. Login to your ownCloud installation and check that you can see the Files section.

2. Get your ownCloud file location

For this you will need to SSH into your owncloud server and point it to the location you installed ownCloud into. My installation sits at /usr/share/owncloud/data/adam/files. Where ever your ownCloud Data folder is, navigate to it and cd into your users folder and take a note of the location, you will need it later.

3. Install BitTorrent Sync on your local machine

If you have not already done so, install the BitTorrent Sync application on your local machine where you want to sync data to (go here to download).

Once you have that installed (I’m on Mac OS). Open BitTorrent Sync and you should see the below menu (will be slightly different on Windows). Once you have that window, right click on the folder you want to sync to (you can add another folder if you want, im going straight into my BTSync folder). Then click copy secret.

4. Link your ownCloud server location with BitTorrent Sync

In the BTSync WebUI – click Add Folder. You will see the below view:

Paste the Secret you copied from the Application in step 3 into the Secret box – and put the location of your ownCloud files in the Path field. Click Add.

5. Test!

Congratulations – you should now be all set! Copy a file into your local machines folder and wait for it to be synced. This should only take a few seconds to complete.

You may get permission issues on ownCloud after you do this – or BTSync may not be able to do much. My installation of BTSync runs at root access, so it can put files anywhere. You may have to add your user to www-data to allow it access to the files location. If you cant figure it out put as much information as you can in the comments and I will try to assist!

Permissions

When you have completed everything it BTSync is complaining that the Destination folder is not reachable or ownCloud has permission errors, run the below commands on the files folder under owncloud/data/user.

sudo usermod -a -G www-dataย  root
chown www-data:root files

Comments

  • Boby

    This is exactly what I was thinking of doing a couple of days ago. ๐Ÿ™‚ But did you disable the csync which comes by default with owncloud? I saw many people complaining about the sync issues in owncloud …

    • I never had issues with csync but did read a lot about it, I havent touched it but I dumped the ownCloud client application, was not good!

  • ikmpatel

    I have set up BTsync, but have not really played with ownCloud, too much. For personal use, I want to replace Dropbox, but I also want to replace Google and Flickr for photosharing and general file sharing with family but not Google, Yahoo, or the NSA.

    My family have neither patience or interest in working with anything that doesn’t work like Dropbox. To that end, I’m inclined towards ownCloud because of the web client, but can you elaborate on your criticisms of ownCloud? I understand your solution to use the best of both, but I prefer to keep my server installation as clean and clutter free as possible.

    • ownCloud is a pretty clean application if you install it using the SQLite option, you don’t need MySQL to host it, just a web server. I have mine in a directory off from the usual /var/www so I don’t clutter up my web root. I have a CNAME on my domain going to subdomain.adammatthews.co.uk, and a server record in my Lighttpd config pointing to my owncloud installation when you use that subdomain. As you can see my installation sits in /usr/share/owncloud, nice and tucked away.

      My only gripe is that it can be a tad slow, but the user management is great. Sharing between users is OK, I’ve not used the inter-system sharing much but I have had my family upload photos to it and share them with me (I’ve also just SSH’ed into the server and downloaded them direct from their user folder).

      Another issue with this setup is that it is not as straight forward to configure as Dropbox, but then a little more work means you get complete control. You would need to setup accounts for your family, then setup BTSync on their machines / add a folder in your computers BTSync for them, then use the /usr/share/owncloud/NAME/files in the servers BTSync Setup.

      Then there is availability and backup. If your internet goes down your family cant access it from the web. If your house burns down (god forbid), you loose the server and the original machines. I am yet to get a decent offsite for my RasPi, I’m working on something to BTSync the entire filesystem to a hard drive in my parents house somehow!

      There are a number of apps on there too, and you can have a shared calendar, contacts book etc. The files part is decent, there is a good community around it too.

      I started moving away from Dropbox / Google Drive in February after a spate of reports about the NSA skimming data off the atlantic cable directly, wasn’t happy with that. I’d much rather my content stayed within the UK, and it mostly stays under my TV in my living room ๐Ÿ˜€

      You don’t get the powerful collaborative stuff, but then hey, its free and self hosted!

      I hope that clears a few things up, if it sounds like rambling let me know, I will clarify anything you need!

      No PRISM access around me ๐Ÿ˜› You can go one step further with ownCloud and get a self signed (or signed if you want to pay for it and you have a static IP) SSL certificate to help secure the connection when using ownCloud. Pretty nice.

      • ikmpatel

        Thanks. I already have backup to private remote sites through Crashplan, so not looking for solution there. So far its working well. I just want a solution only for sharing photos and videos and to sync work files across multiple computers of different OS. I was sharing pics of baby with family through Google and Dropbox, but I just don’t trust either of them and don’t like their T/C. I was working on migrating away, but sync-ing the transition with the NSA story is good timing, to put a burr in the media giant’s pants. Day after Guardian article, I deleted all the files and closed accounts even though I was not ready for the move, it interrupted overseas vacation, and don’t care if Obama sees pic of my baby (she is super cute). I don’t care if the program is `targeted` for foreigners only or just collect metadata, its just plain wrong, especially doing it secretly.

        I already have a webserver/DVR running mysql and such, so its not a problem what I run. I just don’t want to keep it to either ownCloud or BTsync, not both. The solution has to be easy for novice computer users to share with.

        On BTsync, do you know how the client computers find each other? I understand that data itself is not stored in the cloud, but is there web server to facilitate hand-shaking?. How does one BTsync client find another from only the secret key?

        Are you currently running on RasPi? Do you notice any lag or slowness with ownCloud?

  • Chris

    Dear Adam
    Thanks a lot for your quick tutorial. I got to the setup as described by you but I have an issue with permissions:

    Ubuntu Server 12.04, OC 5.07

    I use a folder in my home directory as owncloud data file:

    /home/user/data

    I did

    chown www-data:www-data /home/user/data

    i am syncing with btsync the folder:

    /home/user/data/btsync-user/files

    The sync of the client works but when I login to the OC Installation via the webpage then i get an error message in the browser: “You don’t have write permission here”.

    The ls -l looks like this:

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

    inside that folder:
    drwxr-xr-x 6 www-data www-data 4096 Jul 8 14:33 user

    inside that folder:
    drwxr-xr-x 2 www-data www-data 4096 Jul 8 13:56 files

    Do you know what I have to do so that I can upload files via the webbrowser as well?

    Any help would be very much appreciated.

    Chris

  • Chris

    Edit:
    insode the folder /home/user/data/btsync-user/files

    the permissions are:

    drwxr-xr-x 3 root root 4096 Jul 8 15:15 NewFolder

    WHat can I do so the files are being created by BTsync as www-data?

    Greeitngs, Chris

    • gjcb

      I have the exact same problem… I’m trying to run btsync process as the BTsync user but that way i can’t reach my web-ui. Running process as root does allow me to reach web-uit…

      Help!!

  • Pingback: Some cloud storage / online backup providers compared (DropBox, Sugarsync, Bitcasa, …) « The Wiert Corner – irregular stream of stuff

  • Mint

    In light of your other posts on using XBMC with Raspbmc, I’d like to ask if it’s possible to run both BT Sync and XMBC on the same Raspberry Pi at the same time, and if you’ve done so. If it works, would there be any downside to it? I am already using BT Sync with my PCs and Android, and considering getting a Pi for persistent syncing, but I’m also interested in trying one out for XBMC. It would be cool to have both applications in such a small package. Thanks for any thoughts!

  • Hi Mint,

    Thanks for reading ๐Ÿ™‚ I see my visitor stats but its nice to hear from a reader!!

    Currently I am running Raspbian with BTSync / OwnCloud. I see no reason why you should not be able to run BTSync and XBMC on the same Pi! When I was running XMBC I had Lighttpd webserver running, acting as a joint development area for my university group project (3 people pulling updates from SVN at crazy times of the day!).

    The great thing about the Raspberry Pi is that as it takes up no space and is so small (mine is powered by my BT Home Hub routers USB port!!) you can just play around until you get a config you like. Start by installing Rasbmc and getting XMBC working, then build up from there.

    The process should be very similar to the above, if you do get any issues pop a reply in here and I will see if I can help out ๐Ÿ™‚ If you do get everything setup let me know!

    Since I wrote this post I’ve rebuilt my Pi about 3 or 4 times, using Rasbmc and Raspbian. My biggest piece of advise will be keep a logbook! Ideas, notes and commands you use (inc web links) of things you do to your Pi, config changes especially. I just clip config files into Evernote and if I mess things up I just look at what I’ve changed and revert it.

    You could probably run XMBC, BTSync, a web server and a Bit Torrent downloading application on the same box if you overclock it slightly. If you do all that I highly suggest running https://github.com/imjacobclark/Raspcontrol on it (after you have a web server installed) so you can keep an eye on the temperature and other things.

    http://blogs.richardson.com/2013/07/19/some-dos-and-donts-for-better-lead-nurturing-and-follow-up/

    That guide is amazing (Ubuntu / Debian, same animal!) for getting a webserver setup with Firewall.

    Thanks,
    Adam

  • John

    Hey!

    Great solution Adam! I’m not very familiar with both but I’m currently planning to use one of them. Maybe both now after reading your post.

    However, some things came to my mind:

    Why do you not use the normal syncing client? What does it lack? I read somewhere, local P2P sync is missing (in comparision to BTsync and Dropbox). Anything else? Performance?

    Does it really break nothing on the server side? I thought normally the server’s owncloud file directory should not be accessed manually (or rather via BT sync in this case)?

    Did you finish your offsite-backup solution yet?

    Cheers
    John

  • Pingback: Et si on faisait un vrai cloud personnel ? | PowerJPM

  • Brian

    Hello, thanks for this tutorial, I just set up a personal cloud with it, excited to start using it!. My issue is that it seems Owncloud does not have permission to delete, version, or rename any file/folder that it did not upload. For example, I uploaded a file within owncloud itself, which has versioning, as well as options to rename, download, share, and delete. A file uploaded by bitsync, however, within the owncloud web UI, I can only download and share. I cannot delete, and most importantly, it does not keep track of versions. Is this because of incorrect permissions, since bitsync is not in owncloudโ€™s usergroup? Does anyone know a way to go about fixing this? I want to enable versioning on files that were uploaded with bitsync pretty much. Thank you.

  • ch

    I wouldn’t advise people to run btsync as root or add www-data user to the root group both expose you to a world of danger. Install btsync under a btsync user (the default) and add btsync to the www-data group

  • What’s the benefit of BTsync exactly?

  • jospoortvliet

    Heya,

    This is kind’a cool. I do have a few comments:
    * don’t do it this way, instead, use ‘external storage’ to mount the folder which is synced with btsync in ownCloud. If you change files underneath ownCloud, data can get corrupt and lost.
    * the ownCloud client (csync + gui) should have its issues worked out. Of course, syncing N-to-N, like it does, is a Hard Problem but we haven’t had any data loss bugs for a while now. Note that btsync isn’t as smart in the syncing department and is likely to lose your data if you do things like simultaneous editing of files.
    * note that btsync is not open source – that’s a security risk as it means we (you, me, security experts) can’t audit the code and check if it does something evil.

    Otherwise, have a lot of fun with both btsync and ownCloud ๐Ÿ˜‰

  • Romuh

    Hi and thanks for this tutorial and information. Just couple of my thoughts. I have recently installed OwnCloud on small “server”. I would definitely recommend small and low power HP Thin Client ( I personally bought this fanless thing for under $70). Machine is much more powerful than Raspberry, has 1GB of RAM, ATOM processor which is a beast comparing to Pi, can boot from any drive attached to it.
    My config is Owncloud with external drive attached through USB, encrypted with TrueCrypt (in case it is stolen). Ubuntu server installs very easy (as its 32bit architecture), works flawless.

  • Bish

    You’re really running a closed-source network-accessible app as root? If you’re worried about prism and not random binaries running as root, you may need to reconsider.

  • ridwan

    can i make it now.. because btsyn.?c change to resilio

Leave a Comment