1

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

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. Use scp and SimpleSSHD to place the public key in the SimpleSSHD authorized_keys folder. Use something along the lines of

    scp -P 2222 /home/user/.ssh/id_rsa.pub 192.168.1.2:/data/user/0/org.galexander.sshd/files/authorized_keys
    

    where you replace the default port, public key file information, IP, and target location as needed. [NOTE: the public key needs to exist in a folder authorized_keys inside the target path. The above command will create that folder and place the public key inside]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.