4

A simple requirement over which I am breaking my head!

I want to keep a folder on my computer in sync with the folder on my android device. There are times when the file on the computer will be 'new' and times when the file on the Android device will be 'new'.

Both the devices are connected to the same wifi network. How do I do that?

Here is what I have tried already.

  1. Syncthing - mixed bag results. Syncs at times. Does not at others. Unreliable. So, unusable
  2. Connecting the Android device over KDE Connect. Try Unison to sync two folders. Fails giving an error:

f1.txt — transport failure • Error in renaming /home/user/.config/kdeconnect/99899/kdeconnect_sftp/99899/storage/emulated/0/sync-dir/.unison.f1.txt.01a8d60d253c276456cc2d6db4c37c9b.unison.tmp to /home/user/.config/kdeconnect/99899/kdeconnect_sftp/99899/storage/emulated/0/sync-dir/f1.txt: Operation not permitted [rename(/home/user/.config/kdeconnect/99899/kdeconnect_sftp/99899/storage/emulated/0/sync-dir/.unison.f1.txt.01a8d60d253c276456cc2d6db4c37c9b.unison.tmp)]

deshmukh
  • 4,061
  • 3
    Umm... Dropbox or Google Drive? (limited storage though!) – pomsky Nov 30 '17 at 12:19
  • Dropbox or Google Drive: That's stress-free since you have internet... – George Udosen Nov 30 '17 at 12:21
  • Syncthing would also be something worth looking at...and better for your privacy. – Bruni Nov 30 '17 at 12:21
  • 1
    @pomsky Dropbox and Google Drive require so many permissions on my Android device! All I want to do is just keep two folders is sync!!

    Moreover, I do not know of a client for Google Drive on Linux

    – deshmukh Nov 30 '17 at 12:32
  • @George Please see my comment above – deshmukh Nov 30 '17 at 12:32
  • @Bruni Yes. I, too, thought that syncthing would be perfect for the job. But the results were quite unreliable. It worked at times and failed at others with no apparent causes. :( – deshmukh Nov 30 '17 at 12:33
  • @deshmukh That's one thing very wrong with those apps :( BTW Insync is a pretty good Google Drive application for Ubuntu, but non-free! – pomsky Nov 30 '17 at 12:38
  • Try lrsycnd - https://github.com/axkibe/lsyncd See also https://askubuntu.com/questions/343502/how-to-rsync-to-android – Panther Nov 30 '17 at 15:24
  • 1
    @deshmukh You could look into Dropsync on Android. It does actual syncing, unlike the Dropbox app. I use it myself. – wjandrea Nov 30 '17 at 17:37

1 Answers1

1

I solved similar problem by the following actions.

Steps for Android device:

  1. switch Wi-Fi on;
  2. install SSH server - SimpleSSHD;
  3. start SimpleSSHD server.

Steps for computer (my laptop runs Ubuntu 16.04.5 LTS MATE):

  1. switch Wi-Fi on (in the same network as Android);
  2. enable key-based SSH authentication by running scp -P 2222 /home/$USER/.ssh/id_rsa.pub android@11.22.33.44:/data/data/org.galexander.sshd/files/authorized_keys (where 11.22.33.44 is an IP address of the Android device) and enter password shown on screen of Android device in SimpleSSHD window.

  3. install SSH FS with sudo apt-get install sshfs;

  4. create SSH FS mount point (/media/MyAndroid in my case);
  5. install FreeFileSync and create synchronization job for /media/MyAndroid and local folder;
  6. mount Android device with sshfs android@11.22.33.44:/storage/sdcard1 -p 2222 /media/MyAndroid/ (where /storage/sdcard1 is a folder to be mounted, 2222 is SSH server port), enter SSH password when prompted;
  7. launch FreeFileSync job when needed to synchronize Android device and local folder;
  8. unmount SSH FS mount with sudo umount /media/MyAndroid or fusermount -u /media/MyAndroid (and then one can stop SimpleSSHD on Android device).

This looks first-time difficult, but works great.

You can try to automate this with RealTimeSync (I did not tried, I sync twice a week manually).

Note: if you want to sync external SD-card (normal dedicated microSD) you need to get root access and install SD Card Fix (tested on my Android KitKat 4.4.4 device).

N0rbert
  • 99,918