atextor / atextor.github.com

Github Page
1 stars 1 forks source link

Automate All The Things: Android and SSH #3

Open atextor opened 6 years ago

atextor commented 6 years ago

Please leave your comments for Automate All The Things: Android and SSH here.

francwalter commented 5 years ago

I use the SSH Plugin paid since long, but I am not happy with its (nearly not existing) error handling. I wonder if it's not possible to directly use the command line for ssh (as Run Shell Action) in Tasker to replace the plugin which is since long not anymore developed. Possible?

atextor commented 5 years ago

In principle that should work, but requires the phone to be rooted, which I can't do with mine. If you try it, I'd be happy to hear about your results.

francwalter commented 5 years ago

But there is natively no ssh command on Android, at least not at Android 7.0 With the command ssh in the Terminal as root (su) I get a:

/system/bin/sh: ssh: not found

So I assume the ssh-libraries are just missing in Android. That is why it is apps or plugins (as SSH Plugin paid) needed.

EDIT: I just found old tests with my former phone (SGS4) where I indeed could do it. There was ssh on the command line, it was CM or Lineage something. I did there: ssh -i /path/to/key/on/system/drive/key -T username@192.168.0.120 where the key had to be on the system path (/data/) because ssh rejects the key not having 600 as file permission, which is not possible on the sd-card (with fat32/extfat). That worked indeed!

atextor commented 5 years ago

I see. Technically, it should still be possible to install a ssh binary also on newer Androids, if you have root access, right? Of course this would have to be built to run there (e.g. with the correct library dependencies or static binary).

francwalter commented 5 years ago

I tried with Termux, where I can install packages with pkg: pkg install openssh but there (after install without error) I get that error, when I try ssh: ssh CANNOT LINK EXECUTABLE "ssh": library "libcrypto.so.1.1" not found No help in this special case, I didn't find anything about that with the same issue (on Android). I asked Termux developer but till yet no answer... No success neither with dropbear (which is also available in Termux pkg, but throws errors on install already because same missing lib).

EDIT: after: pkg upgrade the install of openssh did work in Termux! Will test later if the Termux's openssh is usable in Tasker...

francwalter commented 5 years ago

In Tasker it did not work, got errors.

placyd commented 4 years ago

For me helps:

  1. reinstall Turmux
  2. pkg upgrade
  3. pkg install openssh
owlcard commented 1 year ago

Thanks for posting this - I nearly got this working using the first method - the command can execute from connectbot manually but when I run the tasker action it just creates a new host in connectbot that connects to my server fine but won't run the command I have configured. Do you have any advice please?