I own exactly two computers. Both of them run Ubuntu.

Since I bought the second to largely replace the first, initially I copied my home directory over to the new laptop and all was well. However, I ended up using both, and their state started to diverge.

To maintain a similar environment, I would like to sync the dot files between these two machines. Preferably without needing them to be on at the same time or in the same place.

My dotfiles contain virtually everything of electronic importance to me: passwords in pass, the GPG keys, SSH keys, know hosts, etc.

How can I simply and securely sync my dotfiles between two computers running Ubuntu?

If it helps, I do have always-on servers which could act as intermediaries but I don't trust their security enough to allow data like this on them in plaintext.

  • I have the same problem with four distro's on one laptop. Not to mention adding the other two laptops into the equation. I hope there is an app out there too. Silly me I used up all my up-votes with six hours still left in the day. – WinEunuuchs2Unix Aug 12 '18 at 21:18
  • @WinEunuuchs2Unix I can still up vote so I do for now ;) – Ravexina Aug 12 '18 at 21:28
  • 1
    What would you consider secure? – wjandrea Aug 12 '18 at 21:35
  • @wjandrea I interpreted it as wanting to zip up the files with a password before sending them to server. I think that's good enough security? – WinEunuuchs2Unix Aug 12 '18 at 21:46
  • @Ravexina Thanks. I'm back in the voting game so voted up the question plus your answer :) – WinEunuuchs2Unix Aug 13 '18 at 0:17

With simplicity in mind : Buy a cheap usb stick, encrypt it, and copy the file on that stick when you need to move files from one computer to another. Or buy a less cheap self encrypting usb disk or stick.

Instead of a usb stick, use a disk image file, that you can even copy to the untrusted servers. But you'll have to copy the file from one computer to the other, via temp storage on the servers. So in the end, 3 copies are around... Probably exactly what is needed to mess things up.

Instead of copying files, on the encrypted storage (usb stick or disk image), use unison. It's available via apt. Unison can perform two way synchronisation (what they call reconciliation, I think). See the unison user manual. This is less simple to set up.

Or, another simple way : tar your dotfiles, encrypt with gpg, put on the untrusted servers. Ask your search engine for GPG usage. This site is a possibility. But again, 3 copies will rapidly exist...


What I suggest is using a "private git repository on Gitlab".
And of course you have to exclude your important data if you don't trust Gitlab owners or employees.

You can also create a simple script which creates an archive from your passwords, keys, etc and then encrypts those using your GPG then add and commit that instead of plain text information.

There is a really nice guide here: The best way to store your dotfiles: A bare Git repository

or if your computers are sitting at the same network just clone your local repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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