Make a DropBox-like mount for Hubic on linux

First: disclaimer:

  • I have no parts in ovh and I am not linked to them in any matter.
  • The method given here exposes your hubic credentials in clear in a plain file. It also mounts your hubic accounts for all users. Only use this method if you know what you do!

Hubic is the storage service solution by OHV.

It offers 25GB for free and some very competitive paid options. While that sound great, there is a small probelm though : Their linux desktop client sucks.

If, like me, you want to auto-sync your 25GB account on your file system, just like Dropbox or UbuntuOne does, here is how I did it:

The trick is to mount a webdavfs folder to your hubic account, and then, replicate this folder to your local file system.

Thanks to GR’s analysis on the messaging used by the hubic client, I slightly modified its script to directly mount the folder.

Step 1: Install davfs2

sudo apt-get install davfs2

Step 2: mount your dav folder

Download the mount script from github

sudo mkdir /mnt/hubicdav
sudo chmown user /mnt/hubicdav
sudo chmod +x hubic.py

You can then test your mount:

sudo python hubic.py yourhubiclogin yourhubicpassword /mnt/hubicdav

If everything goes right, you should be able to browse your hubic files in /mnt/hubicdav

If so, you can automate the mount:

sudo cp hubic.py /usr/local/bin/
sudo vim /etc/init.d/hubic

In this file, just launch the mounting script:

#!/bin/sh
 
python /usr/local/bin/hubic.py yourhubiclogin yourhubicpassword /mnt/hubicdav

Save the file

sudo chmod 600 /etc/init.d/hubic
sudo update-rc.d hubic defaults

Step 3: Synchronize your davfs with your local file system

We will unison to sync the folders but other methods might suit best your needs (lsyncd, rsync etc).

mkdir ~/hubic
sudo apt-get install unison
vim ~/.unison/hubic.prf

Here is my hubic.prf file:

root = /mnt/hubicdav/
root = /home/user/hubic

ignore = Path .Trash-*
ignore = Path lost+found

Test your unison config file:

unison hubic

On the first run, unison will display some warnings, just answer the questions it asks.

Finally, we can cron the synchronization.

Here is the entry to add to your crontab to run it every 30 minutes:

*/30 * * * *   unison -batch -auto hubic
    • Lunatic
    • September 26th, 2012

    Merci beaucoup pour ce billet simple et clair !

    Je note juste une petite coquille à l’étape 2, sur la commande chown ;)

    Pour rapprocher hubic d’un fonctionnement à la Dropbox, on peut utiliser incrontab pour surveiller les modifications d’un dossier (par contre il ne me semble pas que ça puisse être récursif).

    • Pascal
    • November 9th, 2012

    Merci pour ce script!

    Visiblement le script ne marche plus depuis quelques jours!

    Une idée?

    Pascal.

    • Laurent
    • December 9th, 2012

    @Pascal
    ovh a lancé une mise à jour de son service hubic.
    cela doit probablement impacter certains utilisateurs

  1. No trackbacks yet.