this post was submitted on 02 Feb 2024
14 points (76.9% liked)

Open Source

30221 readers
199 users here now

All about open source! Feel free to ask questions, and share news, and interesting stuff!

Useful Links

Rules

Related Communities

Community icon from opensource.org, but we are not affiliated with them.

founded 5 years ago
MODERATORS
 

Disclaimer : I am absolute noob in terms of SSH kind of stuffs.

I maded a SSH key on ConnectBot app on android.I still have password of that key.I got a private and public key.I shared public key with tildes for making accounts.Now they know me by my that key but I want to login by termux. On termux I installed openssh and tried to login it says that authentication failed.

So I just need to backup keys from connected bot and restore on termux and my PC . Will it work ? How to do it? Will making a new pair of keys using same pass and name will work?

I did not got anything regarding this on searches

top 8 comments
sorted by: hot top controversial new old
[–] [email protected] 10 points 7 months ago

According to the ConnectBot issue tracker, it's not possible to retrieve the private key that it created. You'll have to make a new key pair, and share the new public key with tildes. The keys are randomly-generated, so the new pair will be different, regardless of whether you use the same password.

[–] [email protected] 4 points 7 months ago

You should do one private key per host. If you want access to something with a key from you phone and computer you should have one key on each. To use ssh from somewhere, from that place to your computer, gitlab, whatever, it needs the private key in the correct place. If it is a shell (like termux) it should be e.g. yoir home folder then .ssh/id_rsa. If its an app, I guess ot tells you(, but I would not give my private key to a random app). To be able to get to somewhere, like from your phone to your computer, your computer needs the public key. The cannonical place to put it is as a single line in a file 'authorized_keys' in the .ssh folder in your home folder.

[–] [email protected] 3 points 7 months ago

I'm not sure where ConnectBot stores its keys, so I can't help with the 'transferring to termux' part :-)

What I can tell you is that you should be able to generate and use SSH keys directly in Termux. Here's a quick guide on how to do it: https://gist.github.com/evandrocoan/f503188587587d7b1d1ba8746c9c6107

I've switched phones recently, and I haven't set up my keys yet, but as far as I recall I went through a similar process a few years ago to set up SSH keys on my phone (I haven't tried the steps in that article myself).

[–] [email protected] 3 points 7 months ago (1 children)

I thought title just said sh and not ssh i got really scared

[–] Gooey0210 1 points 7 months ago

Nobody here is insane enough to talk about sh

[–] [email protected] 3 points 7 months ago (1 children)

I don't know connectbot, but it's probably not putting the keys where openssh is expecting them.

By default, ssh looks for keys in ~/.ssh/id_rsa(.pub for the public key).

What I would do is just run ssh-keygen from termux, let it create the .ssh folder and set the correct permissions etc., see where it put that folder, and then just replace the id_rsa files with those from connectbot.

[–] [email protected] 8 points 7 months ago

Just highlighting a small bit for redundancy: Make sure the correct permissions are set in your .ssh folder!

[–] Gooey0210 2 points 7 months ago

ConnectBot is screwed, just use termux, so much easier and stable