How to use Seafile library snapshot to protect your data from Ransomware

A few weeks ago, a new ransomware named “WannaCry” attacked a lot of computers around the world. The ransomware encrypts all the data in affected computer and asks for ransom with BitCoin for “decrypting” the data. However, security experts warn that even if users transfer the ransom, it’s still not possible to recover the data.

This kind of ransomware appears from now and then. It never stops threatening people’s data. “WannaCry” got people to know that how vulnerable their data is. The only valid defense against ransomware is an up-to-date backup of your precious data. Since backup is something Seafile is very good at, we’d like to share how to use one of Seafile’s special feature — library snapshot to easily recover your data.

How does Seafile Protect Your Data

First of all, Seafile cannot help you to decrypt the data encrypted by ransomeware. Whenever you change or add a file inside a synced library, Seafile automatically creates a new version on the server. The old versions of a file is still kept in library history. From Seafile’s point of view, when the ransomeware encrypts a file, it just creates a new version of that file. So you can still find the original version on the server.

File history is a pretty standard feature of all file sync and share products. However, Seafile goes one step further to help you recover all of your encrypted data very easily. Seafile creates a snapshot of the entire library whenever any change is applied to the library. Users can look into any snapshot in the history and restore the entire library to the status of that snapshot, in just one click. Simply put, every library has a “time machine” built into it. With other cloud storage products, you have to either recover the files one by one, or write a script to recover the files in batch. Dropbox does provide a similar service, but users have to contact support manually to ask for recovery.

How to Restore to a Snapshot

In Seafile web interface, navigate into a library. You can find a small “clock” icon on the top-right position of the file list. You can click that icon to view library’s history.

library

Hover your mouse over any change record in the history page. You’ll see the “view snapshot” link.

view-snapshot

Click that link, you’ll see the status of the library after that change was applied.

restore

To the top-right of the file list, you can find a “Restore” button. Clicking that button will restore the entire library to this snapshot state.

That’s it! You defeat ransomeware within a minute. Enjoy!

How to fix tray icon display issue on Ubuntu 14.04

If you’re using ubuntu desktop 14.04, there is a known problem in the seafile linux client 5.1 and later: The tray icon of seafile client would appear on the top-left corner of the screen.

This is a bug that exists in Qt versions earlier than qt 5.5. And lots of other software are also affected by it. Ubuntu 16.04 is not affected by this bug because it ships with Qt 5.5 (while ubuntu 14.04 ships Qt 5.2).

Here we provide a workaround for this bug.

The Workaround

First install the opt-qt561-trusty ppa and Qt 5.6 packages. The packages are installed to /opt/ so your system won’t be affected.

sudo add-apt-repository ppa:beineri/opt-qt561-trusty
sudo apt-get update
sudo apt-get install qt56base qt56translations qt56webengine

Download the wrapper script, which tells seafile-applet to use the Qt 5.6 libs we installed just now.

wget -O seafile-applet-qt56 https://gist.githubusercontent.com/lins05/6468059d8130ad50464b1b3b43ec46dc/raw/c23e84c435b60c528d06e40be239689f9947b9ed/seafile-applet-qt56
chmod +x seafile-applet-qt56
sudo mv seafile-applet-qt56 /usr/local/bin/

Then download the updated seafile client desktop file, which launchs seafile client through the wrapper scripts you downloaded just now:

wget -O seafile.desktop https://gist.githubusercontent.com/lins05/6468059d8130ad50464b1b3b43ec46dc/raw/c23e84c435b60c528d06e40be239689f9947b9ed/seafile.desktop
sudo cp seafile.desktop /usr/share/applications/seafile.desktop

Now you can launch seafile-applet from the ubuntu dashboard (quit the client first if it’s running). The tray icon of seafile client should appear in the correct position.

Finally, tell apt not to override the seafile.desktop file when you upgrade seafile client in the future:

sudo dpkg-divert --add /usr/share/applications/seafile.desktop