18

I have a few different linux machines and a lot of config files (and folders) on each.

For example:

~/.ssh/config ~/.config/openbox/rc.xml ~/.config/openbox/autostart.sh ~/.scripts/ ( folder ) ~/.bashrc ...etc 

Is there a simple and elegant method to keep these files synced between my machines ( one has no internet access )?

Also, some files will need a more advanced syncing process, as they will have to differ slightly... for example:

My desktop keyboard has a range of hotkeys, where my laptop has almost none. I use XF86Mail to open thunderbird on my desktop, but Meta+M on my laptop.

My Home Desktop and Work Desktop are both more "multiple user" orientated, where my Laptop is just for me. So on my laptop, I tend to keep the 'rc.xml' file for openbox at /etc/xdg/openbox/rc.xml but on the desktops at ~/.config/openbox/rc.xml

5 Answers 5

12

Keep the files under version control. This has multiple benefits, including facilitating keeping files synchronized (commit on one machine, update on the others) and keeping a history of changes (so you can easily find out what broke a program that worked last month).

I use CVS and synchronize the repositories with Unison or sneakernet, but that's because I've been doing this since a time before widely-available distributed version control. Anyone starting now should use a proper distributed version control tool, such as bazaar, darcs, git, mercurial, ...

Managing files that need to differ between machines is always a bit of a pain. If the configuration language allows conditionals, use them. Otherwise, if there is an include mechanism, use it to split the configuration file into a machine-dependent part and a shared part. Keep all the machine-dependent parts in a separate directory (something like ~/.local/NAME/) which is always referred to through a symbolic link (~/.here -> local/NAME on each machine). I have a few files that are generated by a script in the shared part from parameters kept in the machine-specific part; this precludes modifying these files indirectly through a GUI configuration interface. Avoid configuring things in /etc, it's harder to synchronize between machines.

1
  • I use git for this purpose. my repo for ~/.etc I also have a ~/.usr and a ~/.var I wish that these directories were standard so KDE would stop throwing all tmp/var/config/etc files under .kde. so hard to know where what I want is in my home directory. Commented Sep 5, 2010 at 14:18
5

I agree with the version control answer, but another method I've been experimenting with recently is Dropbox. It's essentially a version control system that automatically syncs between all your machines, so if you edit a file on one computer you'll see the changes reflected on your other computers in a couple seconds, without needing to commit on the former and update on the latter.

Their free basic plan is 2GB, so I use it to version my configuration files and chat logs

1
  • the major benefit i see here is that it's much easier to setup-up. Commented Sep 2, 2015 at 19:41
3

Puppet and Cfengine are two good tools for syncing files (and a lot more..)

1
  • There's also chef but these tools are really for managing a large number of machines, probably overkill for 2 or 3 systems Commented Sep 5, 2010 at 14:20
1

Today, one could get the best of the first (dvcs) and second (dropbox) responses with sparkleshare, which provides a dropbox-like user experience with git-based storage behind the scenes.

0

filetailor is an open-source Python program for this exact issue. Based on a YAML configuration file, it can make small changes to the files using device-specific variables or using device-specific comments in the files.

Disclaimer: I had this same issue and made filetailor to solve it.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.