rsync over ssh with Android phone

Status
Not open for further replies.

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I just found a program for my Android phone for backing up my internal and external sd cards. It uses rsync over SSH. Using the manual I started trying to set this whole thing up. On the phone I got a key and everything looked good until I tried to create the rsync task. Then I get the error "In order to use rsync over SSH you need a user with a public key (DSA/ECDSA/RSA) set up in home dir."

I did create the private and public key on my phone and pasted the contents of the public key into the appropriate field in FreeNAS. If I understand everything I've read in the last 2 hours my key is dss since the key starts with 'ssh-dss'. I emailed the android app developer to see if it is possible to use dss and I am waiting for a response. The program appears to use an ssh program called dropbear and I'm not sure if it supports dss or not(fairly certain the answer is no though). The android app creates the public and private key and has no options at all so I'm thinking I won't be able to make those key types.

Does this all make sense? Do I seem to understand what the problem is? Is it possible to easily add support for dss to FreeNAS? Is there a reason why dss isn't supported(aka it isn't secure)? I plan to do all of this over my home wifi so I'm not oo terribly concerned since my wifi encryption is not likely to be cracked.

Of course, if anyone has any other alternatives to backing up Android phones that is automated I'm all ears. This whole thing started when I decided I need to have a backup solution for my sd card on my phone(my sd card failed a few weeks ago and I has a week old backup just by chance).
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
From what I've seen, dropbear is kind of the bottom of the barrel ssh and has limited support for features. What app are you using to do your backups? Titanium Backup (TiBu)? I know the pro version has an option to upload backups to the cloud, but I haven't looked at how it does stuff. You maybe be able to do your backup to your SD card, then use the method below to push it that way. I've got keys setup for using my laptop, but haven't done it with either of my android devices. I'm pretty sure "ssh autotunnel" lets you use keys, but I'm not sure which types.

I use "ssh autotunnel" to create a connection to my NAS (3g or wifi), then AntTek Explorer will let you use that tunnel to create an SMB connection that allows my to push and pull files to either my phone or tablet.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I do use TiBu and it does backup to my Dropbox. But TiBu doesn't backup your entire sd card to anywhere. My Droid Bionic actually has 2 "sd cards", /mnt/sdcard(internal storage) and /mnt/sd-ext(true microsdhc card). I was hoping to backup the entire contents of both of them nightly or something.

First I was going to try to use a Windows program since I connect it to my laptop every night at bedtime. No good options there.

Then I tried rsync(not going so well so far).

Now I'm trying to see if there is a program that can copy over a cifs share.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
noob, the app you linked to in the OP, i have successfully used on a non-FreeNAS system. I havent played with it in a long time, nor have I tried to use it with FreeNAS, but I had pretty good luck with it.

The key I found out was to use TASKER to schedule the rsync job under 2 conditions:
Phone/Device is plugged into USB/Wall Charger
within a specific time frame while i slept

I wish I could remember what I had to do to set it up on one of my old phones, but in all seriousness, Folder Sync will work EXACTLY like you need, without a huge hassle. I have used it, and I own the full version. The initial sync takes forever, but the subsequent syncs are pretty quick.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
I downloaded it, added an account, which had the SMB/CIFS tunnel info, and I'm doing a sync from my Titanium Backup folder on my SDcard right now. It took a little messing around with the account settings on Foldersync and discovering I needed to create an account with my SMB settings, but it seems pretty smooth and not that hard to setup.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Here are 2 screenshots, one of my SSH Autotunnel settings, the other of the settings for an SMB Account for Foldersync
 

Attachments

  • Foldersync_Screenshot.jpg
    Foldersync_Screenshot.jpg
    64.8 KB · Views: 406
  • SSH_AutoTunnel_Screenshot.jpg
    SSH_AutoTunnel_Screenshot.jpg
    75.5 KB · Views: 434

budmannxx

Contributor
Joined
Sep 7, 2011
Messages
120
I've had success using Titanium Media Sync. It's not free, but it works very well. You specify a local folder, a remote folder, and a method for connecting to remote (Dropbox, FTP, SFTP, or FTPS). SFTP supports public key encryption and a custom port. I generated my SFTP keys on one of my desktops, saved the private key as a file, copied it to my phone, and pasted it into the app.

You then have options on how often to sync, and under what network (Ethernet(?), Wi-Fi, 3G, 4G LTE, and/or 4G WiMAX) and power conditions (AC charger only, AC/USB charging, or AC/USB/battery). For the mobile data options, it even lets you specify if you want to sync while roaming as well. Finally, you can set it so the local folder either syncs or archives to the remote folder. I use sync for my TiBu folder and archive for my nandroids.

@noobsauce, clearly we've gotten off topic with regards to rsync, but this app does only upload files that have changed. I don't see any reason why you couldn't specify your /sdcard folder as local to get a full backup to your FreeNAS.

The only glaring feature it's missing is the ability to specify a Wi-Fi network to sync on. Basically what happens is if I'm on someone else's wifi and I plug my phone in (since my power setting is "AC only"), the program will attempt to connect to my FreeNAS, and the connection will fail since I'm not on my home network. Not a huge deal. I have no affiliation with the Titanium team, just a happy user. Well worth the $3.44.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
budmannxx, you might want to add Tasker to your arsenal and then you can automate that exact thing with regards to being able to specify wi-fi ;)
 

budmannxx

Contributor
Joined
Sep 7, 2011
Messages
120
you might want to add Tasker to your arsenal and then you can automate that exact thing with regards to being able to specify wi-fi ;)

Agreed, Tasker definitely has way, way more functionality. Last time I looked at it, frankly, I was overwhelmed by the massive amount of customization it allows. Maybe it's time for me to take another look. I guess I only prefer Media Sync due to it doing pretty much one thing very well. And I'm sure there's another forum somewhere where this conversation now belongs, since we've pretty much hijacked it away from relating to FreeNAS.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I actually own Ti Media Sync.. I'm not a fan of FTP since I experienced firsthand how awesome FTP is as corrupting files. It has no packet or protocol checskum :(

I actually think I found something that will do what I want. Still testing it to figure out how it works. It's called AndSMB and you have to buy the "pro" license for the syncing. Not sure if it will work well if files have changing data but not size.

I think any discussion regarding backing up your android phone to FreeNAS is valid for this thread.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
I actually own Ti Media Sync.. I'm not a fan of FTP since I experienced firsthand how awesome FTP is as corrupting files. It has no packet or protocol checskum :(

I actually think I found something that will do what I want. Still testing it to figure out how it works. It's called AndSMB and you have to buy the "pro" license for the syncing. Not sure if it will work well if files have changing data but not size.

I think any discussion regarding backing up your android phone to FreeNAS is valid for this thread.

I've used AndSMB and still have it loaded, but it wasn't as useful as I thought it was going to be. Most file explorers in Android have an SMB module built in or loadable on request. I keep it around just in case, but its just been sitting there.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
AndSMB does NOT recognize files that are changed but the same number of bytes. Not a good place to be. For alot of games save files will always be the same size but change contents. So you'd be disappointed when your save file is older than dirt. I will admit that for the average "mom and dad" its easy to setup.

So back to trying the other options in this thread. :)

Edit: I have used FolderSync before. I don't expect it to identify files that stay the same size but the contents are different over FTP or SMB since those don't inherently support doing file checksums like rsync does.

Another Edit: I forgot to mention that I did get a response from the owner of the app in the first post. He said there is no support for other types of keys from the application. While I could do it manually they'd have to be in the proper dropbear format. Dropbear doesn't appear to be too terribly popular and I can't find any key generator that will generate a dropbear compatible format. I'm looking into protosd's idea about rsync though.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Ok, so I bought FolderSync(because buying AndSMB wasn't enough.. unfortunately no refund for me). I tested the FolderSync features and it appears that FolderSync DOES differentiate between files with the same size but different contents(You can choose between MD5SUM and file size check) but in any case FolderSync seems to be perfect. It does also seem to recognize that a file hasn't been updated and doesn't try to resend the file every sync but only the changed/new files.

There are limitations to just using FolderSync(these are the same if I had used rsync too). For instance I must be connected to my network by wifi(encrypted with a random key of maximum length.. and it sucks to have to type it in!) and have a good wifi signal. But an SSH tunnel could fix that easily. In my case my phone uses OpenVPN to connect to my home network when I am away so that would be another alternative.
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
if you play around with Tasker, know that most Locale (app in play store) plugins work directly with Tasker...this brings in soooo many more possibilities for automation tasks
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I bought Tasker. That's the most expensive program I have ever paid for on the Android store, but it looks very cool. I'm not sure exactly what I'll use it for at the moment.. but I'm definitely glad I have the options for future endeavors!
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Tasker is well worth the cost. The possibilities are endless. Here is a good place to get started:
http://tasker.wikidot.com/

A few examples of what I use it for:
Automating schedules for backups at night
Automating SMS/MMS backup upon messaging app exit
at midnight every night, my phone goes into an audio profile (using audio manager pro) that mutes all but leaves ringtones at half level in case of an emergency call from work, turns my screen brightness all the way down and kicks off screen filter profile to make sure my screen doesnt blind me if i have to look at it in the middle of the night. at 7AM everything goes back to normal
sometimes i prefer to only use my phone in portrait mode, but i need it to autorotate in a few apps, like camera, gallery, maps, etc
when i get in my car, my phone syncs via bluetooth to my car stereo, upon bluetooth connection AND the USB being plugged in, tasker turns off my wifi, fires up pandora, and my music is automated in my car

lots of options, lol. i have played around with different profiles over the last few years
 
Status
Not open for further replies.
Top