SparkleShare creates special folders on your computer that automatically kept in sync with a server and other connected clients. Each time you add, update or delete a file, SparkleShare sends the update to the server and all other connected clients. This works very similarly to Google Drive, Microsoft OneBox, and DropBox, but with SparkleShare, you have the freedom to use any server. What's interesting about SparkleShare is that it is using Git as the backend. It is a Git client combined with a directory watch service. Each time you add, change, or delete files, SparkleShare automatically commits and pushes the changes to the remote Git repository.
Install ¶
SparkleShare is available for Windows, macOS, and Linux. Visit the homepage to see the installation instructions.
In this tutorial, I use the Windows version of SparkleShare and connect it to a self-hosted Gitea Git server on a VPS running with Ubuntu 18.04. This is the server you end up with when you followed my previous tutorials about setting up a VPS and Gitea.
You don't necessarily have to set up your server, SparkleShare works with any Git service that provides Git over SSH access, like BitBucket and GitHub.
On Windows, you download the .msi
file and start it to install SparkleShare. Start SparkleShare, and you see a little icon in the taskbar.
Connect directory ¶
As mentioned before, SparkleShare is using Git as the backend. Because of this, you have to first create a Git repository on the server that you want to sync with.
On my self-hosted Gitea server, I create a new project and call it test
. It is reachable with this URL: ssh://git@git.ralscha.ch:44933/sr/test.git
Next, we have to add the public key of SparkleShare to the Git server. Right-click on the SparkleShare application icon, then select SparkleShare -> Client ID -> Copy to Clipboard.
In Gitea, you open the Your Settings menu and the SSH / GPG Keys tab. Click on the blue Add Key button in the Manage SSH Keys section.
Now paste the SparkleShare key into the Content text field and click the green Add Key button.
Right-click on the application icon and select the menu item Add hosted project....
SparkleShare opens the following dialog.
Select On my own server and enter Address and Remote Path. Click Add and SparkleShare tries to clone the repository.
If successful, you should find a new directory in your user home directory (C:\Users\<USER>\SparkleShare\test
). The last part of the directory (test
)
corresponds with the name of the Git repository. You can connect more than one Git repository. Each repository gets its own
subfolder in the C:\Users\<USER>\SparkleShare\
directory.
While SparkleShare is running, it watches for changes in this folder. Add a new file, open the project in Gitea, and you should see the new file there.
Because this is a standard Git project, you can add and change files with any other Git client. SparkleShare picks up the change and downloads it to your computer. Local changes are synchronized immediately to the Git server, but if you change something from another client, it takes a few minutes until SparkleShare picks up the change and downloads it to your computer. The reason for this is that by default, no notification service notifies SparkleShare of server changes, and the client has to fall back to polling. If you experiment with multiple clients, wait a few minutes until you see the changes propagated to all clients.
See this page https://github.com/hbons/SparkleShare/wiki/Notification-service if you are interested in using a notification service for immediate client synchronization. The page contains an example of a Git hook that sends a message to a notification service, SparkleShare clients can connect to this service and are going to be notified immediately when another client pushes changes to the remote repository. In the spirit of self-hosting, you can also install the notification service on your server.
Client-side encryption ¶
Another interesting feature of SparkleShare is to encrypt files before sending them to the server. To enable this feature all you have to do is creating a Git repository with a name that ends with -crypto
. For this example, I created a repository with the name secret-crypto
.
When you add the project, SparkleShare asks for a password. It uses this password to encrypt each file with the AES-256 algorithm that you add to this folder.
SparkleShare omits the -crypto
suffix when it creates the folder on your local computer. In this example it creates the folder C:\Users\<USER>\SparkleShare\secret
The files are unencrypted on your local computer, but when you open the file on the remote Git repository, you see the file with encrypted content.
Note that the file names are not mangled, and the file size of an AES encrypted file is very similar to the original file size. An attacker might deduce information just from the name and size of an encrypted file.
Other locations ¶
SparkleShare creates the folders by default in the user's home directory under C:\Users\<USER>\SparkleShare
.
Although there is no built in function in the GUI to specify another folder, there is a way to do this manually.
In this example I move the test
folder from C:\Users\<USER>\SparkleShare\test
to e:\shares\test
Stop SparkleShare.
Move the folder test
, open the configuration file %APPDATA%\sparkleshare\config.xml
in a text editor, and add a <path>
tag inside <folder>
.
<folder>
<path>e:/shares</path> // <-----
<name>test</name>
<identifier>82872cb1ebdd36c2fcb078282dcba906a4c0e32f</identifier>
<url>ssh://git@git.ralscha.ch:44933/sr/test.git</url>
<backend>Git</backend>
</folder>
You can also rename the folder then you have change the <name>
configuration. Save the configuration file and start SparkleShare.
Instead of moving individual project folders to another location, you can move the whole C:\Users\<USER>\SparkleShare
directory to another location.
For that, you add the <folders_path>
tag inside <sparkleshare>
. Stop SparkleShare, move the folder, and start SparkleShare.
<?xml version="1.0" encoding="UTF-8"?>
<sparkleshare>
<folders_path>e:/sparkleshare</folders_path>
<folder>
...
See this Wiki page for more information: https://github.com/hbons/SparkleShare/wiki/Configuration-options
Set up a server ¶
SparkleShare provides a script to set up Git very quickly on a Linux server. This is useful if you run your own Linux server but are not interested in installing a full-blown Git server with a Web interface, as I describe in this blog post. This is a more lightweight solution that only requires an SSH server and the Git command-line tools.
Login to your Linux server and then issue the following commands as root user:
Download the script:
curl https://raw.githubusercontent.com/hbons/Dazzle/master/dazzle.sh --output /usr/bin/dazzle && chmod +x /usr/bin/dazzle
Run the initial set up. This command installs the Git package, if not already installed, and creates a new user "storage".
dazzle setup
To link a client, run this command. Run this command for each client you want to connect to this server.
dazzle link
The command prompts for the Client ID. Copy and paste the Client ID from your computer.
Paste your Client ID (found in the status icon menu) below and press <ENTER>.
Client ID:
The link
command appends the key to the /home/storage/.ssh/authorized_keys
file.
Create a project either unencrypted with create
or encrypted with create-encrypted
. You can run this command multiple times if you need more than one project.
dazzle create PROJECT_NAME
dazzle create-encrypted PROJECT_NAME
Both create commands create a Git repository and show the Address and Remote Path that you have to enter in the SparkleShare client.
dazzle create testproject
Creating project "testproject"...
...
Project "testproject" was successfully created.
To link up a SparkleShare client, enter the following
details into the "Add Hosted Project..." dialog:
Address: ssh://storage@51.38.124.133:
Remote Path: /home/storage/testproject