ribbons / TaskerRsync

An Android app providing Tasker plugin actions to allow running rsync over SSH.
https://nerdoftheherd.com/projects/rsync-for-tasker/
GNU General Public License v3.0
18 stars 1 forks source link

Copy between two local folders also checks for the existence of a private key #130

Open khurshid-alam opened 1 year ago

khurshid-alam commented 1 year ago

Is it possible to sync between local folders ?

For example, /storage/emulated/0/Pictures/Screenshots and /storage/sdcard1/Pictures/Screenshots/ ?

I tried that..but it is giving error. Though I can't see that. Flashing variable on %stdout, %stderr doesn't work.

Android 5.1

ribbons commented 1 year ago

Yes, all being well that should be possible (one of the integration tests is performing a local copy). It would be worthwhile figuring out how to view the returned error so you aren't flying blind.

One thing you might be hitting (that springs to mind) and is on my list of improvements is that Rsync for Tasker requires you to have generated a private key before attempting a local copy (even though it isn't actually needed), so that would be worth trying.

Let me know how you get on.

khurshid-alam commented 1 year ago

@ribbons Yes. Thanks. It worked after generating public key.

I deleted the generate key step after that. Tasker steps only have

  1. Get public key
  2. Rsync
  3. Flash %stdout %stderr %pubkey

image

But where is this pubkey located ? Can I use my own private/pubkey pair (generated from laptop) ?

ribbons commented 1 year ago

Glad that did the trick. You don't need to run the 'Get Public Key' action if you're only running against local folders, generating a private key (once) is just a workaround for the current slightly over-zealous key existence check.

The 'Get Public Key' action returns the public key so you can copy it to an SSH host. It is not intended for the private key to be easily accessible (or be easily overwritten by a key generated elsewhere) for security reasons.

I'll go ahead and rename this issue to reflect the original cause of the problem you hit.

khurshid-alam commented 1 year ago

It tried to used this public key but it is not working.

  1. I copied etc/ssh/ssh_host_ecdsa_key.pub from my server to known host field
  2. Copied the public key to authorized_keys of my server which is openssh server running Ubuntu 20.04
  3. However sync is hanging and getting time_out.
  4. I also tried using my own openssh private key with dbclient arguments section

"-i /storage/emulated/0/id_ed25519"

but those are not working either. Getting string is too long error which is probably due to incompatibility between openssh and dropbear ?

  1. Atm Local sync working but unble to sync to a localhost.
ribbons commented 1 year ago

Okay, glad local sync is working for you. If you're having trouble running sync to a remote host that's quite a different issue to what you first described. I'd recommend checking out the troubleshooting steps I covered in #118 and if you're still having trouble connecting once you've followed those, open a new issue and include the verbose output from the dbclient action.

khurshid-alam commented 1 year ago

@ribbons Thanks. That worked! The trick was to use ed25519 key with ssh-keyscan -t ed25519 <host.ip> as mentioned in #118 (Which is different than what I have in /etc/ssh/)/. Rsync is now also working.

Though I am getting this warning : ignoring unknows option -4, even though I didn't use such option. I think it is used for ipv4 ? But that's seeperate issue.

ribbons commented 1 year ago

@ribbons Thanks. That worked! The trick was to use ed25519 key with ssh-keyscan -t ed25519 <host.ip> as mentioned in #118 (Which is different than what I have in /etc/ssh/)/. Rsync is now also working.

Excellent :+1:

Though I am getting this warning : ignoring unknows option -4, even though I didn't use such option. I think it is used for ipv4 ? But that's seeperate issue.

I think that message is caused by rsync passing an option to dbclient that it doesn't understand (so the warning can be ignored in this instance).