0

I am trying to use SimpleSSHD (Dropbear) on my Android phone, which creates an SSH Server on the phone. I can connect to the phone with Putty, but I need a single-use password which Dropbear creates.

I'm trying to write a Python script to run from my Raspberry Pi to connect to my Android SSH server, but need to get around the single-use password requirement.

I've seen that I can get around that password requirement, with the use of authorized_keys. Where I'm having trouble is what exactly is the public key, and where to put it.

On my RaspberryPi I successfully created a ~/.ssh/id_rsa.pub file which looks like

ssh-rsa AAAABSh[huge long string of things]asdfg pi@raspberrypi

Then on the Pi, I did the following commands:

touch ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

But, Dropbear on Android still says no authorized keys, generating single-use password

Do I need to remove the ssh-rsa and pi@raspberrypi from my public key? Is that why Dropbear isn't seeing an "authorized key"?

  • The key has to be authorized on the system you are connecting to. So if you are connecting from the Pi, you need to copy your id_rsa.pub from that system into the authorized_keys file on the Android – Fox Mar 11 at 5:32
  • 2
    You don't need the touch. And more impotently the authorized_keys needs to be in dropbear (The accessor, can not authorise them-selves.) – ctrl-alt-delor Mar 11 at 8:07
  • @Fox - OH! Ok, so from my Pi, I've ssh'ed into Dropbear ...how do I copy a file from the Pi to a folder in there? (Is that a new question? I think it's "too simple" to warrant one -- would it be some version of cat ~/.ssh/id_rsa.pub >> [directory on Dropbear]? (Or would ~/.ssh be referring to the Dropbear config, since I'm SSH'ed in to that?) – BruceWayne Mar 11 at 14:35
  • @ctrl-alt-delor it's a separate app, technically called "SimpleSSHD". (I apologize if my semantics are wrong, as searching around online it seems dropbear is a more general term for this functionality?) – BruceWayne Mar 11 at 16:48
  • I have added some more to my answer, but have not used this app. Please respond by improving your question. Not everyone reads the comments: A nice simple question is the best way to go, containing all the info that is needed. Then delete your comments. – ctrl-alt-delor Mar 11 at 16:55
0

The authorized_keys needs to be in dropbear, on the android (The accessor, can not authorise them-selves.)

dropbear should have an authorized_keys file, you must append it to that. It will tell dropbear, to allow access to the owner of the private part of this key.

How to

I have never used dropbear. But if you can, then do something like:

mkdir ~/.ssh/authorized_keys.d #in dropbear

scp ~/.ssh/id_rsa.pub «my_username@my_android»:~/.ssh/authorized_keys.d/id_rsa.pub # in the Pi

cd ~/.ssh; cat authorized_keys.d/*.pub > authorized_keys #in dropbear

Format of the file

Do I need to remove the ssh-rsa and pi@raspberrypi from my public key? Is that why Dropbear isn't seeing an "authorized key"?

NO, do not remove the ssh-rsa, as this will break the file. Do not remove the pi@raspberrypi this is in the comment section, and will be ignored. It is useful when you come to remove keys, as you can see where they came from.

  • Thanks! I was able to copy the key to the Android device with this - but for some reason now when I ssh in to the Android, it still asks for a password and says no private key found. But, that's a new question after I do some more research. Thanks for your help! :D (Edit: What does the .d do in the foldername?) – BruceWayne Mar 11 at 22:49
0

no need to remove You just need to put authorized_keys file in your android /etc/dropbear folder (or in another file /opt/etc/dropbear if there is no /etc/dropbear ).

after that do.

chmod 0600 /etc/dropbear/authorized_keys
  • i mean in this case put it on android device and i mean if there is no /etc/dropbear folder put it on /opt/etc/dropbear im sorry im just newbie in here – Ivan Yudinata Purwanto Mar 11 at 11:39
  • Did you know that you can edit, your answer? If you make it clear, then I will change down-vote to up-vote. – ctrl-alt-delor Mar 11 at 16:30
  • thank you ctrl-alt-delor – Ivan Yudinata Purwanto Mar 12 at 14:42

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.