Difference between revisions of "BitTorrent Sync"

From ArchWiki
Jump to: navigation, search
(See Also: Removed Unofficial FAQ link that went to example.com)
(replaced external links (https://github.com/lahwaacz/wiki-scripts/blob/master/link-checker.py (interactive)))
 
(37 intermediate revisions by 18 users not shown)
Line 1: Line 1:
[[Category:Internet Applications]]
+
[[Category:Internet applications]]
[http://labs.bittorrent.com/experiments/sync.html BitTorrent Sync] (BTSync) is a file sharing system that relies on the [http://en.wikipedia.org/wiki/Bittorrent BitTorrent] protocol, and differs from other file sharing software in the connection type between devices. Instead of uploading the files to an online server, and then each device fetching them from the server itself, the file transfer is done directly from peer to peer, and therefore there is no limit on data storage and/or transfer speed.
+
[[ja:BitTorrent Sync]]
 +
[https://www.getsync.com/ BitTorrent Sync] (BTSync) is a file sharing system that relies on the [[wikipedia:Bittorrent|BitTorrent]] protocol. Instead of having a central server which archives every file, this syncing method uses peer-to-peer connections between the devices themselves therefore there is no limit on data storage and/or transfer speed. The user's data is exclusively stored on the devices with which the user chose to be in sync with, hence it is required to have at least two user devices, or "nodes" to be online. If many devices are connected simultaneously, files are shared between them in a mesh networking topology.
  
 
== Security ==
 
== Security ==
  
BitTorrent Sync encrypts the traffic between devices with AES cypher and a 256-bit key created on the base of the secret — a random string (20 bytes or more) that is unique for every folder to be synchronized.
+
All traffic between devices is encrypted with AES-128 in counter mode, using a unique session key. This key is derived from a 'secret' which itself is a random 21 Byte key Base32-encoded. By handing over the 'secret', files and folders can be shared with other users.
 
+
== Secrets ==
+
 
+
BitTorrent Sync uses a specific method for folder sharing, the 'secret': a random 21-byte key Base32-encoded.
+
  
 
== Synchronization ==
 
== Synchronization ==
Line 18: Line 15:
 
== Installation ==
 
== Installation ==
  
{{AUR|btsync}} can be installed from the [[Arch User Repository|AUR]]. The package includes [[systemd]] service definitions for managing the btsync daemon. This package creates a default /etc/btsync.conf for system/root operation. Before enabling with systemctl review this file and make desired changes, e.g. to the login id and password.   
+
{{AUR|btsync}} can be installed from the [[AUR]]. The package includes [[systemd]] service definitions for managing the btsync daemon. This package creates a default /etc/btsync.conf for system/root operation. Make the desired changes (e.g. login id and password) to those files prior to enabling the service-file with systemctl.   
  
Alternatively, the bare 'tar.gz' packaged executable is downloadable from the [http://labs.bittorrent.com/experiments/sync.html official website]. The rest of this guide assumes that you are using the btsync AUR package.
+
Alternatively, the bare 'tar.gz' packaged executable can be downloaded from the [http://www.bittorrent.com/sync/download/ official website]. The rest of this guide assumes that you are using the btsync AUR package.
  
 
== Usage ==
 
== Usage ==
Line 26: Line 23:
 
The Linux client of BTSync does not use a typical GUI, instead it sets up a WebUI server accessible at {{ic|localhost:8888}}. Shared folders can also be configured statically in a configuration file, but doing so disables the WebGUI.
 
The Linux client of BTSync does not use a typical GUI, instead it sets up a WebUI server accessible at {{ic|localhost:8888}}. Shared folders can also be configured statically in a configuration file, but doing so disables the WebGUI.
  
Once installed, you'll first need to create a configuration file at {{ic|~/.config/btsync/btsync.conf}}, see [[#Configuration]]. When that is done, start and (if you want it to start on boot) enable the service:
+
Once installed, you'll first need to create a configuration file at {{ic|~/.config/btsync/btsync.conf}}, see [[#Configuration]]. You will also need to create the {{ic|storage_path}} directory. When that is done, start and (if you want it to start on boot) enable the service:
  # systemctl start btsync@user
+
  $ systemctl --user start btsync
  # systemctl enable btsync@user
+
  $ systemctl --user enable btsync
replacing {{ic|user}} by the desired username. The service will run as the named user.
+
The service will run as the user invoking the command. Note that the above command is ''not'' run as root: doing so may lead to a cryptic error stating that D-Bus has refused the connection.
  
You can also run it as the {{ic|btsync}} system user, just leave the {{ic|@user}} part out:
+
{{note|It is important to make sure that when {{ic|btsync}} is run as the user, the {{ic|btsync.conf}} file and directory where the {{ic|btsync.pid}} file will be located have the correct user permissions, i.e. are owned by the user invoking the command. Failure to do so will prevent the service from running. If the user permissions are correct but {{ic|btsync}} still fails to run after being enabled, restart your system.}}
 +
 
 +
{{note|If running {{ic|btsync}} on a headless server, enable lingering to start {{ic|btsync}} and keep it running outside user sessions: [[Systemd/User#Automatic start-up of systemd user instances]].}}
 +
 
 +
You can also run it as the {{ic|btsync}} system user, just leave the {{ic|--user}} part out:
 
  # systemctl enable btsync
 
  # systemctl enable btsync
 
  # systemctl start btsync
 
  # systemctl start btsync
Line 37: Line 38:
  
 
== Configuration ==
 
== Configuration ==
A sample configuration file can be created using {{ic|btsync --dump-sample-config}}. You'll probably want to change some of the settings, including:
+
A sample configuration file can be created using:
 +
 
 +
# btsync --dump-sample-config > ~/.config/btsync/btsync.conf
 +
 
 +
You'll probably want to change some of the settings, including:
  
 
* device_name
 
* device_name
Line 44: Line 49:
 
* webui/password
 
* webui/password
  
 +
{{note|The {{ic|btsync}} executable does not create the {{ic|storage_path}} directory if it doesn't exist, you will have to do this manually or use [[#Automatic config file creation]].}}
 
{{note|The storage_path setting defines where metadata will be saved, '''not''' the synced files themselves. Where synced files are saved is configured on a per-folder basis in the WebGUI.}}
 
{{note|The storage_path setting defines where metadata will be saved, '''not''' the synced files themselves. Where synced files are saved is configured on a per-folder basis in the WebGUI.}}
 +
{{note|The configuration option {{ic|webui/password_hash}} does not seem to be working correctly with recent versions of {{ic|btsync}}. Use {{ic|webui/password}} instead for specifying credentials.}}
  
 
===Automatic config file creation===
 
===Automatic config file creation===
  
The {{aur|btsync-autoconfig}} package provides a systemd service (btsync-autoconfig@user.service) that, if enabled, triggers when btsync@user.service starts and creates a config file with default values if it does not already exist. The install script enables btsync-autoconfig@user.service by default.
+
The {{AUR|btsync-autoconfig}} package provides a systemd user service ({{ic|btsync-autoconfig.service}}) which, if enabled, triggers when a user's {{ic|btsync.service}} starts and creates a config file with default values if it does not already exist.
  
btsync-autoconfig@user.service creates {{ic|~/.config/btsync/btsync.conf}} if it does not exist, and guesses some default values of the settings:
+
{{note| If the config file was generated by {{AUR|btsync-autoconfig}} it will be configured with a different port. Rather than 8888, the port for the user's instance of {{ic|btsync}} will be {{ic|7889 + $UID}}. If your {{ic|$UID}} is "1000", the port will be 8889.}}
 +
 
 +
The install script enables the service for all users by default. Although disabling it defeats most of its purpose, it can be disabled using
 +
 
 +
# systemctl --global disable btsync-autoconfig.service
 +
 
 +
Individual users can then enable it if they like:
 +
 
 +
$ systemctl --user enable btsync-autoconfig.service
 +
 
 +
{{ic|btsync-autoconfig.service}} creates {{ic|~/.config/btsync/btsync.conf}} if it does not exist, and guesses some default values of the settings:
  
 
* device_name: {{ic|$USER@$HOSTNAME}}
 
* device_name: {{ic|$USER@$HOSTNAME}}
 
* storage_path: {{ic|~/.btsync}}
 
* storage_path: {{ic|~/.btsync}}
* webui/login: {{ic|$USER}}
+
* webui/login: {{ic|$USER/password}}
 +
 
 +
The script also creates the {{ic|storage_path}} directory set in the config file if it does not exist. This is done intependently from the creation of the config file.
  
 
==Troubleshooting==
 
==Troubleshooting==
Line 60: Line 79:
 
===Missing storage path===
 
===Missing storage path===
  
If you start the service but can't reach the WebUI, check the status of the btsync by entering {{ic|systemctl status btsync@user}}.
+
If you start the service but can't reach the WebUI, check the status of the btsync by entering {{ic|systemctl --user status btsync}} (or {{ic|systemctl status btsync}} for the system-wide instance).
  
A common error is {{ic|Storage path specified in config file does not exist.}}. {{aur|btsync-autoconfig}} does generate a config file, but not the storage directory, do so by entering e.g. {{ic|mkdir ~/.btsync}}.
+
A common error is {{ic|Storage path specified in config file does not exist.}}. This is easily fixed by {{ic|mkdir ~/.btsync}}, or whatever your {{ic|storage_path}} is set to.
  
===WebUI is not running on port 8888===
+
===Ignore some files/folders synchronization===
  
If the config file was generated by {{aur|btsync-autoconfig}} it will be configured with a different port. Rather than 8888, the port for the user's instance of {{ic|btsync}} will be {{ic|7889 + $UID}}. If your {{ic|$UID}} is "1000", the port will be 8889.
+
If you don’t want BitTorrent Sync to track some files in your sync folder, please use <code>IgnoreList</code>. <code>IgnoreList</code> is located in hidden <code>.sync</code> folder.
  
===WebUI is not running on {{ic|7889 + $UID}}===
+
<code>IgnoreList</code> is a UTF-8 encoded .txt file that allows you to specify single files, paths or rules for ignoring during the synchronization job. Each line of the <code>IgnoreList</code> file represents a separate rule. All the files that fall under the ignore filter are not indexed and not counted in the "Size" column in Sync main view.
  
The {{aur|btsync-autoconfig}} does not create $HOME/.btsync directory. This will cause the start up to fail.
+
It supports '?' and '*' wildcard symbols.
  
===Ignore some files/folders syncronization===
+
Note that <code>IgnoreList</code> is applied only to the folder where it is contained and will not work with the files that have already been synced. If you add indexed files to <code>IgnoreList</code>, they will be deleted on other syncing devices. In order to avoid this:
 
+
If you have files in your sync folder that you don't want BitTorrent Sync to track, you can use .SyncIgnore. .SyncIgnore is a UTF-8 encoded .txt file that helps you specify single files, paths and rules for ignoring during the synchronization job. It supports '?' and '*' wildcard symbols.
+
 
+
Note that .SyncIgnore is applied only to the folder where it is contained and will not work with the files that have already been synced. If you add indexed files to .SyncIgnore, they will be deleted on other syncing devices. In order to avoid this:
+
  
 
* Remove the folder from sync on all the devices.
 
* Remove the folder from sync on all the devices.
* Modify .SyncIgnore file on all of them so that it contains same info.
+
* Modify <code>IgnoreList</code> file on all of them so that it contains same info.
 
* Re-add the modified folders.
 
* Re-add the modified folders.
  
==See Also==
+
For further details, please refer to [http://help.getsync.com/customer/portal/articles/1673122-ignoring-files-in-sync-ignorelist-?b_id=3895 Ignoring files in Sync (IgnoreList)]
 +
 
 +
===ARM alignment error===
 +
 
 +
Add the line {{ic|w /proc/cpu/alignment - - - - 2}} to {{ic|/etc/tmpfiles.d/btsync.conf}}. (You need to create the file).<br>
 +
Note that this may lead to performance degradation.
 +
 
 +
== See also ==
  
[http://www.bittorrent.com/help/faq/sync Official BitTorrent Sync FAQ]
+
*[http://help.getsync.com/ Official BitTorrent Sync Help]
 +
*[http://www.bittorrent.com/help/faq/sync Official BitTorrent Sync FAQ]{{Dead link|2015|01|27}}

Latest revision as of 21:02, 27 February 2016

BitTorrent Sync (BTSync) is a file sharing system that relies on the BitTorrent protocol. Instead of having a central server which archives every file, this syncing method uses peer-to-peer connections between the devices themselves therefore there is no limit on data storage and/or transfer speed. The user's data is exclusively stored on the devices with which the user chose to be in sync with, hence it is required to have at least two user devices, or "nodes" to be online. If many devices are connected simultaneously, files are shared between them in a mesh networking topology.

Security

All traffic between devices is encrypted with AES-128 in counter mode, using a unique session key. This key is derived from a 'secret' which itself is a random 21 Byte key Base32-encoded. By handing over the 'secret', files and folders can be shared with other users.

Synchronization

When a device adds a folder for synchronization, a secret is generated. From now on, every device that wants to synchronize that folder must know the secret key.

The synchronization has no speed or size limits, as long as both devices have enough disk space.

Installation

btsyncAUR can be installed from the AUR. The package includes systemd service definitions for managing the btsync daemon. This package creates a default /etc/btsync.conf for system/root operation. Make the desired changes (e.g. login id and password) to those files prior to enabling the service-file with systemctl.

Alternatively, the bare 'tar.gz' packaged executable can be downloaded from the official website. The rest of this guide assumes that you are using the btsync AUR package.

Usage

The Linux client of BTSync does not use a typical GUI, instead it sets up a WebUI server accessible at localhost:8888. Shared folders can also be configured statically in a configuration file, but doing so disables the WebGUI.

Once installed, you'll first need to create a configuration file at ~/.config/btsync/btsync.conf, see #Configuration. You will also need to create the storage_path directory. When that is done, start and (if you want it to start on boot) enable the service:

$ systemctl --user start btsync
$ systemctl --user enable btsync

The service will run as the user invoking the command. Note that the above command is not run as root: doing so may lead to a cryptic error stating that D-Bus has refused the connection.

Note: It is important to make sure that when btsync is run as the user, the btsync.conf file and directory where the btsync.pid file will be located have the correct user permissions, i.e. are owned by the user invoking the command. Failure to do so will prevent the service from running. If the user permissions are correct but btsync still fails to run after being enabled, restart your system.
Note: If running btsync on a headless server, enable lingering to start btsync and keep it running outside user sessions: Systemd/User#Automatic start-up of systemd user instances.

You can also run it as the btsync system user, just leave the --user part out:

# systemctl enable btsync
# systemctl start btsync

Configuration for this user is located at /etc/btsync.conf, and metadata is saved in /var/lib/btsync/ by default. You should review the configuration settings especially user and password, see below.

Configuration

A sample configuration file can be created using:

# btsync --dump-sample-config > ~/.config/btsync/btsync.conf

You'll probably want to change some of the settings, including:

  • device_name
  • storage_path
  • webui/login
  • webui/password
Note: The btsync executable does not create the storage_path directory if it doesn't exist, you will have to do this manually or use #Automatic config file creation.
Note: The storage_path setting defines where metadata will be saved, not the synced files themselves. Where synced files are saved is configured on a per-folder basis in the WebGUI.
Note: The configuration option webui/password_hash does not seem to be working correctly with recent versions of btsync. Use webui/password instead for specifying credentials.

Automatic config file creation

The btsync-autoconfigAUR package provides a systemd user service (btsync-autoconfig.service) which, if enabled, triggers when a user's btsync.service starts and creates a config file with default values if it does not already exist.

Note: If the config file was generated by btsync-autoconfigAUR it will be configured with a different port. Rather than 8888, the port for the user's instance of btsync will be 7889 + $UID. If your $UID is "1000", the port will be 8889.

The install script enables the service for all users by default. Although disabling it defeats most of its purpose, it can be disabled using

# systemctl --global disable btsync-autoconfig.service

Individual users can then enable it if they like:

$ systemctl --user enable btsync-autoconfig.service

btsync-autoconfig.service creates ~/.config/btsync/btsync.conf if it does not exist, and guesses some default values of the settings:

  • device_name: $USER@$HOSTNAME
  • storage_path: ~/.btsync
  • webui/login: $USER/password

The script also creates the storage_path directory set in the config file if it does not exist. This is done intependently from the creation of the config file.

Troubleshooting

Missing storage path

If you start the service but can't reach the WebUI, check the status of the btsync by entering systemctl --user status btsync (or systemctl status btsync for the system-wide instance).

A common error is Storage path specified in config file does not exist.. This is easily fixed by mkdir ~/.btsync, or whatever your storage_path is set to.

Ignore some files/folders synchronization

If you don’t want BitTorrent Sync to track some files in your sync folder, please use IgnoreList. IgnoreList is located in hidden .sync folder.

IgnoreList is a UTF-8 encoded .txt file that allows you to specify single files, paths or rules for ignoring during the synchronization job. Each line of the IgnoreList file represents a separate rule. All the files that fall under the ignore filter are not indexed and not counted in the "Size" column in Sync main view.

It supports '?' and '*' wildcard symbols.

Note that IgnoreList is applied only to the folder where it is contained and will not work with the files that have already been synced. If you add indexed files to IgnoreList, they will be deleted on other syncing devices. In order to avoid this:

  • Remove the folder from sync on all the devices.
  • Modify IgnoreList file on all of them so that it contains same info.
  • Re-add the modified folders.

For further details, please refer to Ignoring files in Sync (IgnoreList)

ARM alignment error

Add the line w /proc/cpu/alignment - - - - 2 to /etc/tmpfiles.d/btsync.conf. (You need to create the file).
Note that this may lead to performance degradation.

See also