Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I'm looking for a way to keep a file (keepass .kdb) on my Droid2 in sync with one on a server.

  • This is just a file on the filesystem - not contacts, calendar, etc.
  • I need bidirectional, not just push or pull. If the server's changes, download it, if the Android's changes, upload it. Yes, this may result in conflicts that need resolved.

I'm using Unison to achieve this between PCs, but there's no Unison client for android. I've found hand-waving about installing OCaml on Android and running Unison on that, but I'm hoping for something native.

Botsync sounds promising, but it's unidirectional - when making a config, you choose if it's upload or download.

I've seen sugarsync, but given that this is my KeePass file, I'd prefer to keep it on my own server.

share|improve this question
    
I was going to suggest sugarsync... but I understand the concern –  Daniel May 20 '11 at 19:06
    
Take a look at sparkleshare.org - relatively new project, Android client in the works, I believe. –  Sparx May 22 '11 at 6:00
add comment

7 Answers

up vote 3 down vote accepted

You might want to consider another option here, if you want to use this for KeePass password database. This won't work for other sensitive material, but since you asked specifically for KeePass, here's what I do:

  • Protect the database with the password (I assume you have, already), and a key. This will give you a two-factor authentication ("something you know" -- your password, and "something you have" -- your key). The password database can only be unlocked when both pieces are in place.
  • Copy the key to the local storage of all your devices, and give it some inconspicuous name. Preferably put it in a crowded directory where it would seem like some configuration file or some random noise file created by a program.
  • Upload your database to a third-party storage service (I use Dropbox, but other options would work just as well). It goes without saying that the service should have an Android client if you want to use it on your device.

  • DO NOT upload your key there -- use another method to copy it to the devices you need. Dropbox in particular keeps a copy of the files you upload and then delete at least for a week for backup purposes (quite convenient, I must admit), but if your key is on the server already, it's not more secure than a normal password-protected database.

  • Configure your KeePass clients not to remember the location of the key (remembering the location of the database is fine).

In this way, you can upload your database to a random website, and even if your password gets compromised for some reason (i.e. keyboard loggers), you can only use the database from devices that have the key AND now which file is actually the key.

For convenience, you might want to have key-only authentication on a mobile device (secure passwords are tedious to type on a mobile device, and you obviously don't want to use anything short and easy here). But I would recommend against this, as in this case the security is even lower than a password-protected database -- instead of a password you have in your head, you use a "password" (the key file) that is on your device.

KeePass doesn't give any hints whether it requires key, password or both -- which works to your advantage.

share|improve this answer
    
+1 for good info, I agree that pass&keyfile should be "enough" for a keepass file. I'm leaving the question unanswered in hopes that there will be a "here's a program that does sync" answer in the future. Thanks! –  Jason Viers Jun 6 '11 at 19:04
add comment

You may have found something you are happy with now but I have compiled a binary of unison that works on android - it is possible using the hand-waving instructions you are talking about - I used them to cross-compile the linux source within ubuntu 12.10 using the android NDK and with a few alterations to the code it is now working. Follow the instructions at https://sites.google.com/site/keigoattic/ocaml-on-android and then you will need to do a few things. There is a file called pty.c in the unison source - find the following section:

// openpty
#if defined(__linux)
#include <pty.h>
/*#define HAS_OPENPTY 1*/
#endif

and comment out define HAS_OPENPTY 1 as shown. You also need to open ubase/util.ml and edit:

let homeDir () =
  System.fspathFromString "/Your path here"

Comment out from here:

    (if (osType = `Unix) || isCygwin then
       safeGetenv "HOME"
     else if osType = `Win32 then
(*We don't want the behavior of Unison to depends on whether it is run
  from a Cygwin shell (where HOME is set) or in any other way (where
  HOME is usually not set)
       try System.getenv "HOME" (* Windows 9x with Cygwin HOME set *)
       with Not_found ->
*)
       try System.getenv "USERPROFILE" (* Windows NT/2K standard *)
       with Not_found ->
       try System.getenv "UNISON" (* Use UNISON dir if it is set *)
       with Not_found ->
       "c:/" (* Default *)
     else
       assert false (* osType can't be anything else *))

...To here!

Then you'll also have to edit Makefile.Ocaml

   CWD=$(shell pwd)
    EXEC_EXT=
    WINOBJS=
    SYSTEM=generic
    # openpty is in the libutil library
    ifneq ($(OSARCH),solaris)
      ifneq ($(OSARCH),osx)
      #  CLIBS+=-cclib -lutil
      endif
    endif
    buildexecutable::
        @echo Building for Unix
  endif
endif

And comment out # CLIBS+=-cclib -lutil as shown.

And as far as I can remember that all worked. The other step once compiled is to mount your android system partition as writable and copy unison to the /system folder where all the rest of the shell commands are.

Hope that is helpful to someone...I lost a lot of sleep getting it compiled.

share|improve this answer
add comment

I do exactly what you ask with FolderSync. It's a very nice piece of software, with plenty of options and features. I use it as a personal dropbox alternative using SFTP over SSH with keyfile for authentication. You can even set it up to automatically detect changes on the local replicas and trigger an immediate upload. On my phone i use it to upload pics on my server as soon as i take them, and it works just perfect.

share|improve this answer
add comment

I use unison by mounting the android with sshfs. As ssh server I use SSHDroid.

But be warned, unison with sshfs is really slow. Though with one single file it should not matter.

share|improve this answer
add comment

I've also followed the cross compilation root as indicated in ChC's answer

I've released UnisonSync that allows you to unison without dealing with the command line (and without rooting) on Google Play:

From the proof of concept, which was quickly running, to a production ready app it took much more time than expected, but now it works and is very handy to sync my publications and datasheet repository.

share|improve this answer
1  
I'll probably consolidate the instructions to cross compile at some point soonish and put the binary unison/dropbear somewhere, for those that prefer to use the command line. –  Dan Oct 26 '13 at 16:56
add comment

I don't know of anything native that does this. There are many file sync apps but all the ones i've seen are either unidirectional, or rely on the user to manually sync the file from the phone to the cloud. What you are intending to do should be possible with the Dropbox API but I don't know if you are willing to create your own custom app that keeps watch over the specific files you need sync'd

share|improve this answer
    
I'd considered the custom app route, but if I do that it'd be writing a native Unison client rather than a dropbox one (so it'll stay on my server). –  Jason Viers May 20 '11 at 16:31
add comment

A market search revealed aFileSync which claims to sync files via FTP and also has support to auto-sync files. You will need to be running an FTP server on your own.

There's also SK Sync, but users have reported mixed results with it.

Obviously, before you try any of these programs / apps, please backup your files both on the PC/server as well as your Android device.

share|improve this answer
    
aFileSync sounds like it has all the behaviors that I want. The reviews are a bit scary, and I'll have to setup a FTP server to see how it goes. –  Jason Viers Jun 6 '11 at 19:07
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.