I have a certain… paranoia when it comes to “cloud” services. Especially the likes of Dropbox, iCloud, etc. The services that “just work.” However, I recognize the value of these services and would actually find them extremely useful. So one day I thought to myself, “Man I really need to solve this problem of having files that I need for my personal life tossed all across four (yes 4) computers.” And then I thought, “Maybe I should just give in and use Dropbox…” Of course then I read things like
this and
this. It isn’t that I have top secret military project files or anything, or that I have a bunch of illegal business goings on that I need to hide from law enforcement, but it is personal information. Stuff that anyone would care to have backed up in a safe, secure location, like banking information, taxes, passwords, etc. Stuff that you would want access to at the drop of a hat from any computer you were on. So…

I’ll make my own dropbox. Using my own server, and free open source software. Here is the process.
First you’ll want to have a server setup and hardened. Hopefully you’re able to do that because the process is too long for this guide. My personal dropbox is made up of 3 pieces of software, git, gitosis, and
SparkleShare. You’ll also need to have
SSH configured to use authentication keys instead of passwords.
For sake of ease, let’s say we’re using a 10.04 Ubuntu fully updated and patched server. First we want to install git so run:
sudo apt-get install git-core
Now that we have git installed we can grab the latest version of gitosis:
cd ~/
git clone git://eagain.net/gitosis.git
cd gitosis
Now we have the source for gitosis downloaded we need python and setup tools:
sudo apt-get install python-setuptools
And now, from the gitosis directory, we’ll install gitosis:
sudo python setup.py install
Cool. Next we need to set up a user to contain our repos and manage our ssl certificates. This user can be whatever, but for sake of ease in this tutorial we’ll just call it “git.” The home directory can be where ever you choose as well, but again, for sake of ease in this tutorial we’ll just put it in /home/git.
sudo adduser --home /home/git --group --system --shell /bin/sh --disabled-password git
That’ll create the user, the group, and a homefolder. It will also disallow password authentication which means we’ll have to use key authentication. Now we’ll have to add our first public key to gitosis so that we have admin access. First copy the public key of the machine you are working on up to the server and run the following where “my_kefile.pub” is your public key:
sudo -H -u git gitosis-init < my_keyfile.pub
That command will load the git user $PATH (important because we are running the gitosis-init binary) and run the gitosis-init binary as the git user. That will create our first git repo, gitosis-admin, and add our key so that we have access. Now a little cleanup. Every other gitosis install guide will tell you that you need to make sure the gitosis-admin post-update hook needs to be made executable. It has always been fine for me, but just incase run:
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
Alright! That is it for server setup. Good job. Let’s head back to your workstation now. Hopefully you have git already installed on your workstation, but if you don’t head
here and download the appropriate installer. Crack open your terminal application and run the following:
git clone git@your.server.com:gitosis-admin.git
This will clone the gitosis admin configuration down to your computer into the directory you are currently in. If you cd into gitosis-admin and have a look around you should see a “keydir” and a “gitosis.conf” file. The keydir stores all the public keys that will have access to your git repositories. The gitosis.conf file is where you set up and configure access to repositories.
First let’s check out how repos are set up. Open up the gitosis.conf file. You should see the default configuration there already, it looks something like:
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = nick_macbook
the [group ..] definition is an arbitrary definition, it can be whatever you want. Next “writeable = ... ” defines the name of the repository that is writeable by the group, in the default case the gitosis-admin repo. Finally “members = ... ” defines the keys that are members of the group, they are the filename of the key minus the .pub extension. So in this case I have a file in the “keydir” directory called “nick_macbook.pub.” I’ve made it a member of the group “gitosis-admin” which has writeable permissions on the repository “gitosis-admin” (write-ability implies read-ability in this case).
Now let’s set up our dropbox repo, add something like the following to gitosis.conf:
[group dropbox]
writable = dropbox
members = nick_macbook
Save the file and head back to terminal and run:
cd gitosis-admin
git commit -a -m "added dropbox repo"
git push
We just entered the gitosis-admin repo, committed the changes we made to gitosis.conf, and then pushed them up to the server. By doing that we created a new git repo that will become our “dropbox” folder. Sweet!
There is a lot to gitosis, but just know that you can add more keys to the keydir, then add the file names without the .pub extension to the “members” definition of any group to grant that key access to the group’s repository.
Finally let’s set up SparkleShare. Once you’ve downloaded the app and copied it to your applications folder, fire it up. After you do that SparkleShare will ask you to set up a remote folder. The “Address” will be your server’s hostname, and the foldername will be the name of the repository we just set up, in this case it is “dropbox.git.” As long as you have your keys set up properly in gitosis, when you hit “sync” SparkleShare will create a new directory in your home folder and boom! You’ve got a drop box. Add any files to that folder and SparkleShare will automatically commit and push them up to your remote server. It’ll also periodically pull down whatever the server has that the local working copy doesn’t. Neat eh?
A Couple Notes
You’ll obviously have to configure your firewall to allow traffic on port 22 for this to work. If you’re having trouble pulling down the repo in SparkleShare, did you remember to push your gitosis conf up?