Keep the same home environment on multiple computers with Dropbox

The problem:

I now use two laptop computers -- my own and the one I got from work. I have been wondering for a while if there was an easy way to deploy the same home environment across different physical machines given that you would need it for some reasons, but not for others. For example, if I want to write code or surf the web with synchronized Chrome instances, I want a uniform environment so I can easily pick up on one computer where I left off on the other. But it's also reasonable for a computer that I use mostly for work to have different settings from one that I use mostly for play: for example, my work computer needs hard drive encryption and remote IT assistance tools, while my home computer does not need MS Office, because for my own letter writing and bookkeeping I am happy with

My proposed solution:

One obvious way to have a uniform home environment across computers with such different requirements is to put it inside a virtual machine. The VM's from different computers keep their common settings in a Dropbox folder, which is updated quietly every time you go online. Here's how that folder could be used to have the same Vim environment across multiple computers, all the time:

My two VM's are Ubuntu 10.04, created in VMware Player 3.1.2 from an x86 ISO disk I burned. Each has a Dropbox folder. In it, there's a vim folder, and in it there's the vimrc.local file that I want to apply on both machines. Now in each VM's /etc/vim/vimrc file I change this:

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local

to this:

if filereadable("/home/username/Dropbox/vim/vimrc.local")
  source /home/username/Dropbox/vim/vimrc.local

For this to work, your username must be the same on the two Ubuntu VM's. If by chance it's not, one easy way to fix the problem is to enable a root account on one of them, as described here, log in as root, then in a terminal window do this:

usermod -l newname -m -d /home/newname oldname

This has the effect that both your login name and your home folder will change from oldname to newname, as explained here.

I wish there was a more elegant way, but I couldn't get /etc/vim/vimrc to source to $HOME, so this user name constraint seems to be binding. A slicker way to go would be if the whole /etc folder could be housed in Dropbox, and your applications knew to look for their runtime configurations there.

How would you solve this problem?

3 Responses to “Keep the same home environment on multiple computers with Dropbox”

  1. Andrew writes:

    I'm gonna throw something out there and let me know if you think it might work for you. I've heard of people putting a symbolic link to folders outside their dropbox folder to sync files from many locations. So, you could try putting a symlink to /etc on VM1 in your dropbox which will sync the entire folder over the web. Now, I'm not too sure what would happen in VM2 though. Could you add a symlink in your /etc folder on VM2 to grab everything in Dropbox's copy of /etc from VM1?

    The process of using symlinks in Dropbox is partially explained here.

    Let me know if you think this may work and if you have any luck :)

  2. Balint Erdi writes:

    Not sure if it serves the same purpose but a friend of mine started to develop something similar:

  3. Gabi Huiber writes:

    Andrew and Balint, thank you for your pointers. I'm not sure if this is worth a separate post, but I did find a satisfactory solution, thanks to my neighbor, an electrical engineer and Linux enthusiast. He is unimpressed that Dropbox will only sync a specific directory. He also doesn't like that Dropbox does not offer a zero-knowledge privacy guarantee. For both reasons, he recommended SpiderOak. I like it. I got the standard 2G free account, backed up the home directory of the Ubuntu VM I like best, installed a pristine one on a different computer, installed the SpiderOak client, instructed it to sync the home directory, and within minutes I had the same environment in both places. Then I went and installed ggplot2 into a user-level library on one of the machines, and SpiderOak immediately made it available to the other. It all works perfectly. Another, local alternative would be to put the master home directory on my subversion server in the basement and check it out into the secondary VM's from there. Checking changes in and out of the repository via svn+ssh would make it feasible for me to always keep things in sync, regardless of where in the world I am. That would work in theory, but I wanted a cloud-based solution.