7

I have downloaded SimpleSSHD (aka Dropbear) to access my Android via SSH.

I am able to do so with the one-time password, but I'm trying to write a Python script that can access the phone.

Is there a way to add a "username/password" to SimpleSSHD so I can put that in to my Python program?

Edit: (I'm really new to this) - it looks like I need to create authorized_keys on my RPi somehow, but am not sure how. Following this didn't seem to do it.

0

1 Answer 1

9

I am new myself, but this is how I managed to do it

  1. Generate SSH keys on your client (RPi in this case) system

    A. Use the command ssh-keygen -t rsa -b 4096 -C "optional_identifying_comment" to generate the key pair

    B. When the shell prompts Enter file in which to save the key it is asking for a file name. Provide your own, or press Enter to accept the default 'id_rsa'

    C. The shell will prompt for a password, provide one (it will have to be used each time you use the key) or press Enter to leave it empty.

    D. Confirm your password

    E. You should now have a pair of keys, a private key (ie. id_rsa) and a public key (ie. id_rsa.pub), usually stored in /home/user/.ssh. The private key is for the client computer (RPi in this case) and the public key is for the server (Android in this case)

  2. Transfer the public key to your Android

    A. Figure out the target address for your Android. You can do so by opening SimpleSSHD, clicking the three dots in the top-right corner and selecting Copy App-private path

    B. Add the public key to the SimpleSSHD authorized_keys file. One option is to use cat:

    cat ~/.ssh/id_rsa.pub | ssh username@hostname -p 2222 "cat >> /data/data/org.galexander.sshd/files/authorized_keys"
    

    Adjust the above to your environment.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .