Search

Ubuntu - Setup a BTSync Client running per User Session

Contents[Hide]

dropcap-ubuntu-btsync

BitTorrent Sync is a new p2p tool which opens some fantastic possibilities. It may revolutionize the way you'll handle your private file sharing as it allows you to share & synchronize your files across multiple devices (PC, tablet, smartphone, ...) on the net in almost real time.

Some examples of the possibilities opened by BTSync are described in the article BTSync - How peer-to-peer may Simplify your Life.

As BTSync is a young project, you can get latest binary from the project site but you still don't get proper Ubuntu installation package handling BTSync daemon launched per user session. With this type of configuration, BTSync will be launched at login time with the current user's credentials.

This article explains how to install a BTSync daemon on a Ubuntu workstation with BTSync daemon being launched at session login using the user's credentials. It will allow your currently logged-in user to share files with a BTSync daemon running using current account. You'll get a synchronisation daemon equivalent to Dropbox.

It has been tested under Ubuntu 12.04 LTS 7 Amd64 but it should be applicable to any debian based distribution with little adaptation.

1. Installation

First step is to download and install latest binary from http://syncapp.bittorrent.com/1.4.111/.

You need to select the .tar.gz according to your architecture.

As it will be used as a normal application, it should be placed under /usr/local/bin.

Terminal
# wget -O btsync.tar.gz http://syncapp.bittorrent.com/1.4.111/btsync_x64-1.4.111.tar.gz
# sudo tar -xf btsync.tar.gz -C /usr/local/bin btsync

2. Configuration

As the BTSync daemon will be launched with user's credentials, all data and configuration files should be managed in the user's home directory as follow :

  • configuration file in ~/.btsync.conf
  • data files inside ~/.btsync/

Default configuration file that will be used at every startup should be based on this one :

~/.btsync.conf
{
"device_name": "user",
"listening_port" : 0,
"storage_path" : "/home/user/.btsync",
"pid_file" : "/home/user/.btsync/btsync.pid",
"check_for_updates" : false,
"use_upnp" : true,
"download_limit" : 0,
"upload_limit" : 0,
"webui" :
  {
  "listen" : "127.0.0.1:8888",
  "login" : "",
  "password" : ""
  }
}

Listening port is preconfigured on 127.0.0.1 so that your configuration can only be done locally. As it doesn't allow connexion from other machines, user and password are not set.

If you change it to 0.0.0.0, make sure to define a login / password.

All the preferences defined in this file will be applied at every session login. So if you change them from the Web Interface, your modifications will be lost at next btsync restart. So, your preferences should be set from the .btsync.conf file to survive restart.

You should also replace user by your login in the configuration file.

All these steps can be done with these commands :

Terminal
# mkdir -p $HOME/.btsync
# wget -O $HOME/.btsync.conf https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/tools/btsync.conf
# sed -i 's/user/'$USER'/g' $HOME/.btsync.conf
# btsync --config $HOME/.btsync.conf

Your BTSync instance is now installed and started.

You can now connect to http://127.0.0.1:8888/ to configure it.

3. Autostart at login

To allow BTSync to run as soon as you login, you should add it to the startup applications with the following parameters :

  • Name : BitTorrent Sync
  • Command : btsync –config /home/user/.btsync.conf
  • Comment : BitTorrent Sync daemon

Replace user with your login name.

ubuntu-btsync-login-startup

You can do it manualy thru the Startup Application menu or by command line :

Terminal
# mkdir -p $HOME/.config/autostart
# wget -O $HOME/.config/autostart/btsync.desktop https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/tools/btsync.desktop
# sed -i 's/user/'$USER'/g' $HOME/.config/autostart/btsync.desktop

You can now reboot your computer.

BTSync daemon will now start as soon as you login.

You are now ready to share your files ...

 

Hope it helps.

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus