SSH command on Android?

89 views
Skip to first unread message

Nathan

unread,
Jun 29, 2023, 4:59:51 PM6/29/23
to Kivy users support
I'm trying to use an ssh tunnel in my Android app, but I get an "FileNotFoundError: [Errno 2] No such file or directory: 'ssh'" error through logcat.

Can anyone explain if/how I can run an ssh command through python on Android?

Thanks,
Nathan

Robert

unread,
Jun 29, 2023, 8:57:23 PM6/29/23
to Kivy users support
The Android command shell is very light weight and there is no ssh.  

Nathan

unread,
Jun 29, 2023, 9:40:23 PM6/29/23
to kivy-...@googlegroups.com
Ok, good to know,  thank you. 

I'm looking at different python libraries that implement ssh functionality instead. Unfortunately, paramiko tends to not compile right with builldozer, which leaves parallel-ssh, or ssh2-python.

My actual goal is an ssh tunnel, which may not work in parallel-ssh for my purposes, and would not be trivial to implement in ssh2-python.

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/fo0gcWWllCs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/50207b82-c56c-4b33-82a8-16806d65592en%40googlegroups.com.

Robert

unread,
Jun 30, 2023, 12:18:44 AM6/30/23
to Kivy users support
I have no specific experience with ssh, but sometimes python packages are just wrappers around a call to the ssh command - just something to check.

Tomek CEDRO

unread,
Jun 30, 2023, 12:37:24 AM6/30/23
to kivy-...@googlegroups.com
On Fri, Jun 30, 2023 at 3:40 AM Nathan wrote:
> I'm looking at different python libraries that implement ssh functionality instead. Unfortunately, paramiko tends to not compile right with builldozer, which leaves parallel-ssh, or ssh2-python.

You need to use something that will not use anything from a system but
provide all-in-one bundle (including ssh/ssl libraries) in your own
application build.

Have you tried https://github.com/pahaz/sshtunnel/ or similar ?

Please keep in mind that there may not be a ready-to-use configuration
in Buildozer/P4A for this and you will have to create it yourself
(like for paramiko or anything else that will do the job).

Its like you want to create a standalone firmware for a bare bone
device where you need to provide all necessary libraries and
components yourself for a custom setup. Kivy/P4A only provides generic
setup and build mechanism. The custom rest is up to the developer.

Good luck and have fun :-)

--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Nathan

unread,
Jun 30, 2023, 12:57:04 AM6/30/23
to Kivy users support
@Robert
Good point. That was exactly the case with bgtunnel, which was pretty disappointing. I'm fairly certain that these other libraries use something else, but it's worth double-checking.

@CeDeROM
Thanks for the advice

Yep, sshtunnel was my first attempt, but unfortunately relies on paramiko. Apparently many other people have had trouble trying to get paramiko to compile as well, so I figured it was best to look for alternatives.
bgtunnel was another library that looked promising, but depends on the Android shell having an ssh command and Robert clarified that it doesn't :(

I'm just hoping someone familiar with the issue sees this and can offer a simple solution. 
In the meantime I'm investigating ParallelSSH, and I might try writing my own ssh tunnel using ssh2-python...

Nathan

unread,
Jul 4, 2023, 1:34:34 AM7/4/23
to Kivy users support
FYI the solution: sshtunnel/paramiko work fine for this. I just encountered a tricky bug where my virtual environment folder being in the same folder as the rest of the project files caused some occasional interference with buildozer/p4a (even though they were configured to ignore it).
Reply all
Reply to author
Forward
0 new messages