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.

  • just scp -P 2222 /Users/user_name/.ssh/id_rsa.pub user@IP_ADDRESS_OF_MOBILE:/data/data/org.galexander.sshd/files/authorized_keys – Amr Lotfy Oct 7 '20 at 19:15

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

    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]

  • 1
    very useful answer, only something is misleading : authorized_keys is not a directory/folder, this is a file, which content must be the content of id_rsa.pub – Niels Aug 12 '20 at 19:22
  • scp -P 2222 /Users/user_name/.ssh/id_rsa.pub user@IP_ADDRESS_OF_MOBILE:/data/data/org.galexander.sshd/files/authorized_keys – Amr Lotfy Oct 7 '20 at 19:14

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.