Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 keybaord 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

share|improve this question
add comment

4 Answers

up vote 9 down vote accepted

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.

share|improve this answer
    
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. –  xenoterracide Sep 5 '10 at 14:18
1  
+1 for unison –  Ali Nov 27 '11 at 17:21
add comment

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

share|improve this answer
add comment

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

share|improve this answer
    
There's also chef but these tools are really for managing a large number of machines, probably overkill for 2 or 3 systems –  xenoterracide Sep 5 '10 at 14:20
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.