BitTorrent Sync

Tutorial – How to set up BitTorrent Sync on a Linux server to create a Dropbox-like syncing solution

btsync_diagram

Update (August 13th, 2017) : BT Sync has now become Resilio. I’ll be writing a new post about another way to get this to work soon.

Update (August 28th, 2013) : The iOS BT Sync app is now available for download. Try it out!

BitTorrent Sync (BTSync) is a “Private Dropbox” of sorts in that it offers the same functionality (syncing your files across devices) but without going through a third-party’s servers. Mac and Windows clients are available for download and have some nifty features such as one-time share keys and read-only syncing options. The advantage of BTSync is better handling of large files (especially if you sync across multiple devices) and you don’t have your files hosted on someone else’s server(s).

The advantage of Dropbox is that should you lose all your machines that were syncing to Dropbox, you would still have a copy in the Cloud that you would be able to download on a new machine. This is undoubtedly BTSync’s biggest disadvantage if you don’t have at least two machines on all the time. If, however, you have a server, you can set up BTSync on that server thus creating your own “always-on” sync machine that will create a copy of the files you wish to sync immediately. Let’s get started…


Assumptions: This tutorial does not aim to teach you how to use the BTSync Mac/Windows clients. For the rest of the tutorial, I recommend creating a test folder on your computer, generating a BTSync key for that folder, and then adding that key to the new BTSync instance you’re about to create on your Linux-based server.

Requirements: This tutorial assumes you have a Linux-based server. It does not have to be a dedicated server but you do need to have enough rights to download and install stuff.

Step 1 – Download the right version

Download the Linux BTSync version that is appropriate for your server here. You’ll notice that there are several versions available:

BitTorrent Sync Linux Download Options
BitTorrent Sync Linux Download Options

If you’re not sure which one is for you, print out your system information using this command:

uname --all

or

uname -p to get your processor.

These commands will output something like:

Linux s123456789.domainepardefaut.fr 2.1.32-042stab076.5 #1 SMP Mon Mar 18 20:41:34 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux

x86_64

For the above output, I downloaded the Linux_x64 version. From the server:

cd /tmp
mkdir btsync
cd btsync
wget http://btsync.s3-website-us-east-1.amazonaws.com/btsync_x64.tar.gz .

Step 2 – Install BitTorrent Sync

Ready? It’s as easy as 1-2-3:

tar -xvzf btsync_x64.tar.gz

This will extract btsync which is the executable. Since we’re still in /tmp, now’s a good time to move the btsync executable somewhere safer. I chose to create a folder at the root level “/BTSync”:

mkdir /BTSync
mv /tmp/btsync/btsync /BTSync

Note that by default, the files that will later be synced to your server will be located in a folder called .sync which will be located in the same folder where btsync runs. Later on, we’ll take a look at some configuration options that can help you modify this behavior.

You’re done. To start BTSync, run:

./btsync

At this point, you should be able to point your web browser to port 8888 on your server and you will see the BTSync GUI (http://youripaddress:8888).

btsyncgui

From here, you can easily sync folders with your server as you normally would by simply adding the shared secret keys that you have set up on your PC. The GUI is simple and easy to use. Though everything “just works” now, I did not want to keep the default port (8888) and password settings that come installed with the GUI. Let’s change that…

Step 3 – Set up a password, change the port (optional)

BTSync allows you to configure some settings, including a password to protect the GUI. To create a configuration file, create a btsync.conf file in the same folder where the btsync executable is located. In my example, that would be in /BTSync. If you want to get an example configuration file, you can execute:

./btsync --dump-sample-config

For convenience’s sake, I’ve made one available for download here.

To set a username/password, create or edit the config file, btsync.config and edit these lines with whatever values make sense for you:

“webui” :
{
“listen” : “0.0.0.0:8888“,
“login” : “YOUR_LOGIN_USERNAME“,
“password” : “YOUR_LOGIN_PASSWORD
}

Replace the bold values by whatever is convenient for you. When you’re done, you’ll need to restart the BTSync server and pass the configuration file as a parameter. To do so, kill the btsync process that you started earlier and restart it using ./btsync --config btsync.config. To get the process ID, simply try to start the btsync process; if it is already running, it will print out its PID:

./btsync --config btsync.config
Can't lock pid file. It seems BitTorrent Sync is already running with pid 1857
kill -9 1857
./btsync --config btsync.config

Update: As pointed out by Arnaud in the comments, you could also just use killall btsync.

BTSync Authentication

Now, when you close and re-open the GUI, you should get a password prompt.

For more information about BitTorrent Sync and the different configuration options available, visit the official website. To download BitTorrent Sync for Windows or OSX, click here.

Conclusion

I’m a big fan of DropBox and I’m happy to see similar services popping up. For most users, I’d say these services have an amazing offer, are easy to use, and are relatively cheap if not free – so if it works for you, stick to them! For power users, or for users who have lots of data they want to sync across several machines, BTSync provides a few advantages at the cost of some user friendliness (for now) and a more complex set up process. By setting up BTSync on a server with very high availability, you eliminate BTSync’s weakest point by allowing for a copy of your synced file(s) to be created almost immediately. You gain the privacy of your own server but you must also keep in mind that your sync capacity and reliability is entirely your responsibility. Finally, if you need to sync very large files, BTSync’s technology is the way to go. (You can read more about the technology used here.) At time of writing, it seems that mobile versions of BTSync are also being developed making BTSync a very powerful all-round syncing solution.

2,701 thoughts on “Tutorial – How to set up BitTorrent Sync on a Linux server to create a Dropbox-like syncing solution”

  1. Questions
    1: does btsync need to be running on only one machinf or every machine that needs to sync?
    2. how does btsync handle nonstatic ip addresses?
    3. I have a home office and a work office. I want to sync both of them to my remote webserver hosted by a third party. Can I do that?
    4. Both work & home have freenas servers for data and are mounted with fstab. Can I sync the mounted directories just like the local directories?

    Your article was good and not too technical. it could have used more high level information

    1. Hi Kirk,

      1/ BTSync needs to be running on every machine that needs to sync.
      2/ BTSync uses Bittorrent technology that is inherently peer-to-peer and IP-independent. I won’t go into details but it basically doesn’t need a fixed IP; it only needs an address that is represented by the shared URL that BTSync creates.
      3/ Yes, that is exactly the scenario that I’m in and why I wrote this. In this case, your server acts as the “man-in-the-middle” that will always have the latest sync so that when you go back home or move to your office, when you turn on that machine, it will sync from the server thus guaranteeing that you have the latest version of the files you were working on from your other office.
      4/ As long as you can point to them from the BTSync client app, you can sync them.

      I tried to keep it simple as much as possible but if there’s more technical stuff you’d like to see, let me know, I’ll be glad to expand.

  2. By adding more servers syncing the same content does that increase the speed of the synchronization? Just like it works for traditional torrents.
    I want to sync 40GB of small files between 2 servers in different continents, if add more servers will this speed things up?

    1. If the servers have more upload bandwith then they should increase the speed. The API has a function to get a third key that will only allow you to downlaod the encrypted version, that way you could use less trustable hosts to increase bandwith and redundancy. Unfortunatly the API is reserved for developers…

  3. This is wonderful. Never done anything like this on a server before, yet it worked out fine. Bit of trouble on the listening port; turned out to be a hosting issue.

    Migrated from Dropbox. Thank you!

  4. Thanks for your tutorial 🙂

    2 little things :
    – you can also kill the process through his name -> “killall btsync”
    – a typo here “To do so, kill the btsync process that you started earlier and restart it using ./btysnc –config btsync.config.” should be “./btsync –config btsync.config”

    Thanks again.

  5. Hi, i follow this tutorial and sincronize the machines, but where i can find the files in client machine?

    my english is not good, sorry ‘-‘

  6. Hey, Thanks for the tutorial; I have it set up an running. My only concern is that the password protected ui still runs on an http page and the password is delivered unencrypted. Is there any easy way to tell bittorrent sync to listen on an https page instead of http?

    1. Hello Petra,
      I have not tried setting this up over HTTPS so I’m not sure but I don’t see what would prevent you from setting up a dedicated HTTPS port and keeping everything else the same, assuming you have the right certificates. Like I said, I haven’t tried this myself so I’m not 100% sure but if I do find anything conclusive, I’ll reply here.

    2. You can always setup a reverse proxy using apache or any other webserver, and make it available on https only.
      This way, you completely ostracize the btsync gui from the web.

    3. I prefer to have the web service only listen on 127.0.0.1 (localhost), not open the firewall to 8888, and instead use an SSH tunnel to forward the port to my desktop. Once it’s set up, you don’t need to use the web interface on the server very often.

      From your desktop:
      ssh -L 9999::8888

      Now http://localhost:9999 on your desktop is connecting to your server’s port 8888 through a secure SSH tunnel.

      If you have to use Windows, Putty can do the same thing.

      1. I’d like to know if two instances of BTSync in different networks can be interconnected via an SSH tunnel, i.e. I don’t want my files floating through the Internet, just between my machines. Any ideas?

  7. Hello.

    Is there anyway to get notified when a folder is synced against certain host via the CLI? On the Windows GUI, I can monitor “Status” column under Devices tab. Could btsync write a file like .synced.device_name or such and remove this file while files are synced?

  8. Hi!

    I’m currently stuck at the end of step 2…

    I have downloaded the archlinux version and extracted the tar.gz (using a GoFlex Home NAS)

    I moved it to /media/BTSync

    When I try to run it, it returns an error. Here is a copy/paste:

    [root@Cloud btsync]# systemctl start btsync
    Failed to issue method call: Unit btsync.service failed to load: No such file or directory.
    [root@Cloud btsync]# cd /media/BTSync
    [root@Cloud BTSync]# ./btsync
    -bash: ./btsync: Is a directory
    [root@Cloud BTSync]# systemctl start ./btsync
    Failed to issue method call: Unit .-btsync.service failed to load: No such file or directory.
    [root@Cloud BTSync]# systemctl start btsync
    Failed to issue method call: Unit btsync.service failed to load: No such file or directory.
    [root@Cloud BTSync]# cd /btsync
    -bash: cd: /btsync: No such file or directory
    [root@Cloud BTSync]# cd /media/BTsync/btsync
    -bash: cd: /media/BTsync/btsync: No such file or directory
    [root@Cloud BTSync]# ls
    btsync
    [root@Cloud BTSync]# cd btsync
    [root@Cloud btsync]# systemctl start btsync
    Failed to issue method call: Unit btsync.service failed to load: No such file or directory.
    [root@Cloud btsync]# ls
    btsync.install btsync.service btsync@.service PKGBUILD
    [root@Cloud btsync]#

    Any help is much appreciated!

    1. The Bittorrent Infrastructure serves as a relay or intermediary (depends) to locate machines and sync files. You can probably find more information on the official Bittorrent Sync website and in the forums.

  9. Hi Great tutorial thanks! I’m a relative newbie when it comes to Linux, so bear with me! I’m having a few issues setting this up on my VPS. Bittorrent Sync is installed on my VPS and I can access it via HTTP no worries I now just need to secure it using btsync.config. when I go to restart the service I get the error: Error while parsing config file: lexical error: invalid char in json text: 8:8888″, “login”: “superadmin”, “pa (right here) ———-^.

    Any help would be greatly appreciated

    1. Hi,

      It’s hard to help you without the entire configuration but one thing I notice is that the double quotes are not the same across your string… this might just be due to copy/paste in this blog but perhaps you’re trying to paste a character that is invalid. Make sure that you are not using any special characters – double quotes can be represented in many different formats, some of which are not valid for JSON. To be safe, try using a simple text editor and save your config file as a .txt. Then, copy/paste from that instead.

      It might be something else entirely in which case I’d need to see more of your config file around those lines.

      PS: To make sure your JSON is valid, I recommend pasting your config file on http://jsonlint.com.

  10. You actually make it seem so easy with your presentation but I find this matter to be really something that I think I would never understand. It seems too complex and very broad for me. I am looking forward for your next post, I will try to get the hang of it!|

    http://promodj.com/maciassoto0

  11. hello there and thank you for your information – I have definitely picked up anything new from right here. I did however expertise some technical issues using this web site, since I experienced to reload the web site lots of times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I’m complaining, but slow loading instances times will sometimes affect your placement in google and could damage your high quality score if ads and marketing with Adwords. Anyway I am adding this RSS to my email and can look out for a lot more of your respective fascinating content. Ensure that you update this again very soon.|

  12. I have been browsing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my opinion, if all web owners and bloggers made good content as you did, the net will be a lot more useful than ever before.|

  13. Oh my goodness! Impressive article dude! Many thanks, However I am going through issues with your RSS. I don’t know the reason why I can’t subscribe to it. Is there anybody else getting the same RSS problems? Anyone that knows the solution can you kindly respond? Thanks!!|

  14. I was recommended this website by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my difficulty. You’re incredible! Thanks!|

  15. Hey! Someone in my Myspace group shared this site with us so I came to check it out. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Excellent blog and terrific design and style.|

  16. Magnificent goods from you, man. I have understand your stuff previous to and you’re just extremely fantastic. I really like what you’ve acquired here, certainly like what you’re saying and the way in which you say it. You make it entertaining and you still take care of to keep it wise. I can not wait to read far more from you. This is really a great website.|

  17. You are so cool! I do not think I have read something like that before. So great to find another person with a few unique thoughts on this issue. Seriously.. thanks for starting this up. This site is something that’s needed on the internet, someone with some originality!|

  18. You really make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complex and extremely broad for me. I am looking forward for your next post, I will try to get the hang of it!|

  19. My programmer is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the costs. But he’s tryiong none the less. I’ve been using WordPress on a number of websites for about a year and am concerned about switching to another platform. I have heard fantastic things about blogengine.net. Is there a way I can transfer all my wordpress posts into it? Any help would be really appreciated!|

  20. Fascinating blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple tweeks would really make my blog stand out. Please let me know where you got your theme. With thanks|

  21. I do love the way you have framed this situation plus it really does present me some fodder for thought. However, from everything that I have personally seen, I really wish when the feed-back stack on that individuals keep on point and not embark upon a soap box of some other news of the day. Anyway, thank you for this superb piece and while I do not necessarily go along with it in totality, I value your viewpoint.

  22. I simply couldn’t depart your website before suggesting that I extremely enjoyed the standard info an individual provide on your visitors? Is gonna be back incessantly to investigate cross-check new posts|

  23. Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I get in fact enjoyed account your blog posts. Any way I will be subscribing to your augment and even I achievement you access consistently quickly.|

  24. I loved as much as you’ll receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get got an nervousness over that you wish be delivering the following. unwell unquestionably come further formerly again since exactly the same nearly very often inside case you shield this increase.|

  25. If you are seeking for the top service to get website visitors to your web page, i advise to use seowebsitetrafficnet. I am using it with a great result. Simply just type “seo website traffic net” in google, yahoo and bing.

  26. Hi there! Someone in my Myspace group shared this site with us so I came to give it a look. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers! Wonderful blog and fantastic design.|

  27. It is appropriate time to make some plans for the future and it’s time to be happy. I’ve read this post and if I could I wish to suggest you few interesting things or suggestions. Maybe you could write next articles referring to this article. I desire to read more things about it!|

  28. Hey! This post could not be written any better! Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this post to him. Pretty sure he will have a good read. Thanks for sharing!|

  29. A different issue is really that video gaming has become one of the all-time largest forms of excitement for people of all ages. Kids enjoy video games, and adults do, too. The XBox 360 is among the favorite games systems for people who love to have a huge variety of video games available to them, and also who like to experiment with live with other individuals all over the world. Thank you for sharing your opinions.

  30. Thanks for your write-up. One other thing is when you are advertising your property yourself, one of the difficulties you need to be mindful of upfront is just how to deal with house inspection reports. As a FSBO seller, the key about successfully transferring your property as well as saving money on real estate agent commission rates is knowledge. The more you already know, the easier your sales effort might be. One area that this is particularly crucial is information about home inspections.

  31. [url=https://furosemidetab.com/]can i buy furosemide without a prescription[/url] [url=https://tadalafilcia.com/]tadalafil usa[/url] [url=https://doxycycline20.com/]doxycycline 100mg[/url]

  32. I’m very happy to read this. This is the kind of manual that needs to be given and not the accidental misinformation that’s at the other blogs. Appreciate your sharing this greatest doc.

  33. My brother recommended I might like this web site. He used to be totally right. This put up truly made my day. You can not consider just how so much time I had spent for this info! Thanks!

  34. We are currently trying to find individuals to review CBD products from leading CBD companies on our website at cbdlifemag.com. If anybody is interested, please respond below or DM me and I will get some CBD items, including CBD Creams, CBD Edibles and CBD Lotion sent to you for your assessment.

  35. Good morning, We would like to take this specific opportunity to invite you to list your business on All Vape Stores, a popular CBD and Vape Company Catalogue. A Tiny Bit about Us – All Vape Stores is a world wide CBD and Vape Store Web directory that is aimed to assist people find their local CBD and vape stores. We presently receive over 100,000 distinct and highly-targeted visitors a calendar month, primarily from the UK and USA. We achieve such a strong website target traffic figure by operating a very successful CBD and vape blog site precisely where we deal with the most recent CBD and vape industry news, customer reviews and user tutorials. We likewise send out regular weekly newsletters to our users when we publish new posts. By listing your company with All Vape Stores, you will get an opportunity to develop your brand’s direct exposure, web site traffic and customer base. Consumers will have the ability to contact you via a contact form straight on your business listing web page. Likewise, you will get a back link from your listing which will aid you with your S.E.O backlink building for organic online search engine rankings. To list your business, feel free to head to: https://allvapestores.com/ We eagerly anticipate seeing you onboard. Kind regards, All Vape Stores Group

  36. Do you have a spam problem on this site; I also am a blogger, and I was curious about your situation; many of us have created some nice practices and we are looking to trade solutions with others, why not shoot me an e-mail if interested.

  37. I simply want to tell you that I’m very new to blogs and definitely liked your page. Most likely I’m want to bookmark your website . You actually have very good posts. Appreciate it for sharing your blog site.

  38. An additional issue is that video games are usually serious anyway with the key focus on knowing things rather than amusement. Although, there’s an entertainment feature to keep the kids engaged, just about every game is frequently designed to work on a specific group of skills or program, such as mathematics or scientific discipline. Thanks for your post.

  39. Veery great post. I simply stumbled upon your blog and wished to mention that I’ve truly loved surfing around your blog posts. In any case I’ll be subscribing to your feed and I am hoping yyou write once more soon!

  40. I think other website proprietors should take this site as an model, very clean and magnificent user genial style and design, let alone the content. You are an expert in this topic!

  41. Hello there, just became aware of your blog through Google, and found that it is really informative. I am gonna watch out for brussels. I’ll be grateful if you continue this in future. Numerous people will be benefited from your writing. Cheers!

  42. Hey there! I could have sworn I’ve been to this blog before but after checking through some of the post I realized it’s new to me. Anyways, I’m definitely delighted I found it and I’ll be bookmarking and checking back frequently!

  43. It’s the best time to make some plans for the future
    and it is time to be happy. I’ve learn this put up and if I may I wish to suggest
    you some attention-grabbing things or tips. Perhaps you could write subsequent articles regarding this article.
    I desire to learn even more issues about it!

  44. I was more than happy to seek out this internet-site.I wished to thanks to your time for this wonderful read!! I undoubtedly enjoying every little bit of it and I’ve you bookmarked to take a look at new stuff you weblog post.

  45. You sing so beautifully.” (I never sing in front of people so when I do and I get this compliement, it’s awesome).
    You’re a really good fighter!” (To which I respond: “Yay! Even though I’ve only gotten submitted like..15 times tonight. But whatever. Thankyou!”)

  46. You smell so good.” (“Really? I mean, if you’re being serious, I’d like to hug you right now”)
    I was walking to the bus one time in leggings and tall, black, high-heeled boots. When I got on this little kid looked at me and said “You looked like a model just then.”(So sweet).

  47. If it’s a compliment on my talents or like-able characteristics, I’ll appreciate it more than a compliment on my physical traits.
    Genuine comments are the most effective, you can really tell if someone means it when they hold your face, look into your eyes and say something so magical that you forget the rest of the world.

  48. Every girl is different, some like to be called cute, others gorgeous. I like to think all girls like creative comments though, something that really took time and consideration before being mentioned. Some girls may appreciate mental comments over beauty, you never know.
    Not just flirting. Sometimes you must say “you don’t look good in this dress” or “you look much prettier in western”

  49. Girls love to know how they look. They don’t just expect compliments. They want to look the best everyday. So, they would like to know how they look. In the beginning, you can only comment on the appearance. once you get closer, you can comment on their routine. Nothing to think seriously. Just go with the flow.
    And it’s not the same with all girls. Each one is different. You should take time to know her and then speak according to her nature.

  50. I loved as much as you’ll receive carried out right here. The sketch is tasteful, your authored material stylish. nonetheless, you command get bought an nervousness over that you wish be delivering the following. unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this hike.

  51. I’m impressed, I have to say. Really not often do I encounter a weblog that’s each educative and entertaining, and let me inform you, you’ve got hit the nail on the head. Your concept is outstanding; the problem is something that not sufficient individuals are talking intelligently about. I’m very completely happy that I stumbled across this in my search for one thing regarding this.

  52. Excellent post. I was checking constantly this blog and I am impressed! Very useful information particularly the last part 🙂 I care for such info a lot. I was seeking this particular information for a very long time. Thank you and good luck.

  53. I simply needed to thank you so much yet again. I am not sure the things I could possibly have gone through in the absence of these ideas contributed by you regarding such a field. It actually was the scary problem in my circumstances, however , being able to see a specialised way you dealt with that took me to cry over happiness. I am thankful for your service and even pray you realize what a powerful job that you’re providing educating many people with the aid of your website. Most likely you have never met all of us.

  54. I¡¦m now not certain where you’re getting your information, however great topic. I must spend some time finding out more or understanding more. Thanks for great information I used to be on the lookout for this information for my mission.

  55. MetroClick specializes in building completely interactive products like Photo Booth for rental or sale, Touch Screen Kiosks, Large Touch Screen Displays , Monitors, Digital Signages and experiences. With our own hardware production facility and in-house software development teams, we are able to achieve the highest level of customization and versatility for Photo Booths, Touch Screen Kiosks, Touch Screen Monitors and Digital Signage. Visit MetroClick in NYC at http://www.metroclick.com/ or , 121 Varick St, New York, NY 10013, +1 646-843-0888

  56. An outstanding share! I have just forwarded this onto a colleague who was doing a little research on this. And he in fact bought me lunch due to the fact that I found it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanx for spending the time to talk about this subject here on your website.| а

  57. Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but instead of that, this is great blog. A great read. I’ll certainly be back.

  58. Have you ever thought about adding a little bit more than just your articles? I mean, what you say is valuable and all. Nevertheless imagine if you added some great photos or video clips to give your posts more, “pop”! Your content is excellent but with pics and clips, this site could certainly be one of the best in its niche. Amazing blog!| а

  59. I would like to thnkx for the efforts you’ve put in writing this website. I am hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing skills has encouraged me to get my own web site now. Really the blogging is spreading its wings rapidly. Your write up is a good example of it.