OpenWrt Forum Archive

Topic: [solved] ssh error: No auth methods could be used

The content of this topic has been archived on 10 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am trying to get git working directly from router since I am developing some scripts on router and it would be convenient to have version control at hands. (First tried nfs client to map develop host directly from openwrt, that failed also)

root@NetgearOpenWrt:~# git clone git@bitbucket.org:<user>/<project>.git
Cloning into '<project>'...
ssh: Connection to git@bitbucket.org:22 exited: No auth methods could be used.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

root@NetgearOpenWrt:~# ssh git@bitbucket.org
ssh: Connection to git@bitbucket.org:22 exited: No auth methods could be used.

root@NetgearOpenWrt:~# cat /etc/openwrt_release
DISTRIB_ID="OpenWrt"
DISTRIB_RELEASE="Bleeding Edge"
DISTRIB_REVISION="r38501"
DISTRIB_CODENAME="barrier_breaker"
DISTRIB_TARGET="ar71xx/generic"
DISTRIB_DESCRIPTION="OpenWrt Barrier Breaker r38501"

Any idea?

(Last edited by Peter on 27 Nov 2013, 11:08)

Other then that you need git to download a git repos not really.

I edited original post with some git actions to clarify that at least git is installed... big_smile

Can you ssh with the same credentials from another client otherthan OpenWRT?

well it tells me access denied on a regular distro as well if i try ssh:

thefriedzombie@whiteserver:~$ ssh git@bitbucket.org
Permission denied (publickey).

(yes i have a private key on that acount)

But it seems you need at least a private key, to be able to connect
either:
dropbearkey -t rsa -f ~/.ssh/identity
to generate a new key to use with busybox ssh, or ln -s /etc/dropbear/dropbear_rsa_host_key ~/.ssh/identity
this way you don't have to specify the ssh -i option that is needed otherwise.

(Last edited by FriedZombie on 27 Nov 2013, 10:58)

I would suggest you to first check your SSH credential allow you in the server.
I say this because the origina error message says you don't have any suitable login credential.
Only then you need to check the private SSH key is in the proper format and places into the proper place.
On a Linux box, for example, you can run

ssh -v -i path/to/private.key user@host

and see what happens, while in OpenWRT dropbear (OpenWRT default SSH implementation) doesn't have a verbose mode.

On normal distro I use ssh-agent in .bashrc.
On openwrt I use dropbear and I am unsure it can be used in this way. Normally ssh automation is from outside in, but I am (as always) trying the opposite tongue
On openwrt it fails:

root@NetgearOpenWrt:~/tmp# ssh git@bitbucket.org
ssh: Connection to git@bitbucket.org:22 exited: No auth methods could be used.

On normal distro it is OK (well, remote shell is not allowed):

peter@debian-programming:~$ ssh git@bitbucket.org
PTY allocation request failed on channel 0
logged in as peter-swe.

Another difference is that id_rsa is binary for dropbear, so I used dropbearconvert to convert from openssh to dropbear.
I follow steps in https://confluence.atlassian.com/displa … SH+for+Git

On openwrt at least this now works:

root@NetgearOpenWrt:~# ssh -i .ssh/id_rsa git@bitbucket.org
logged in as peter-swe.
You can use git or hg to connect to Bitbucket. Shell access is disabled.

I guess I would be done if I just figured out how to remove the -i id_rsa

(Last edited by Peter on 27 Nov 2013, 06:35)

I think you are relying on a .ss/config file (or on a /etc/ssh/ssh_config file) which is not documented.
I think also that the server is accepting key authentication only and this is why that weird error (No auth methods could be used).
So I would guess the private key you are using is either wrong or in the wrong format or put in the wrong place.

And, in case the situation was the other way around (usually you provide your public key to the server), you can give a look here.

To complete this for potential benefit to others...

This fixed it!

My repetition of what I actually did

# Generate your identity key on openwrt
dropbearkey -t rsa -f ~/.ssh/id_rsa

# Convert public key from dropbear binary to openssh text
# Copy and paste output from below to bitbucket account ssh keys
dropbearkey -y -f ~/.ssh/id_rsa | head -n 2 | tail -1

# Change git ssh command
echo "#!/bin/sh" > ~/.gitssh.sh
echo "dbclient -y -i ~/.ssh/id_rsa \$\*" >> ~/.gitssh.sh
chmod +x ~/.gitssh.sh
echo "export GIT_SSH=\$HOME/.gitssh.sh" >> /etc/profile
# Now login again to openwrt

# Now use git (finally)
git clone git@bitbucket.org:<user>/<repo>.git

Solved! Thank you for your help.
big_smile

(Last edited by Peter on 8 Dec 2013, 23:22)

Thank you!

Peter L wrote:

To complete this for potential benefit to others...

This fixed it!

My repetition of what I actually did

# Generate your identity key on openwrt
dropbearkey -t rsa -f ~/.ssh/id_rsa

# Convert public key from dropbear binary to openssh text
# Copy and paste output from below to bitbucket account ssh keys
dropbearkey -y -f ~/.ssh/id_rsa | head -n 2 | tail -1

# Change git ssh command
echo "#!/bin/sh" > ~/.gitssh.sh
echo "dbclient -y -i ~/.ssh/id_rsa \$\*" >> ~/.gitssh.sh
chmod +x ~/.gitssh.sh
echo "export GIT_SSH=\$HOME/.gitssh.sh" >> /etc/profile
# Now login again to openwrt

# Now use git (finally)
git clone git@bitbucket.org:<user>/<repo>.git

Solved! Thank you for your help.
big_smile


I followed all the steps as outlined, but I still get the following error:

dbclient: Exited: Error resolving '$*' port '22'. Name or service not known
fatal: The remote end hung up unexpectedly


Can anybody point me in the right direction?

-Roberto

(Last edited by rhp_74 on 4 Dec 2014, 14:30)

rhp_74 wrote:
Peter L wrote:

To complete this for potential benefit to others...

This fixed it!

My repetition of what I actually did

# Generate your identity key on openwrt
dropbearkey -t rsa -f ~/.ssh/id_rsa

# Convert public key from dropbear binary to openssh text
# Copy and paste output from below to bitbucket account ssh keys
dropbearkey -y -f ~/.ssh/id_rsa | head -n 2 | tail -1

# Change git ssh command
echo "#!/bin/sh" > ~/.gitssh.sh
echo "dbclient -y -i ~/.ssh/id_rsa \$\*" >> ~/.gitssh.sh
chmod +x ~/.gitssh.sh
echo "export GIT_SSH=\$HOME/.gitssh.sh" >> /etc/profile
# Now login again to openwrt

# Now use git (finally)
git clone git@bitbucket.org:<user>/<repo>.git

Solved! Thank you for your help.
big_smile


I followed all the steps as outlined, but I still get the following error:

dbclient: Exited: Error resolving '$*' port '22'. Name or service not known
fatal: The remote end hung up unexpectedly


Can anybody point me in the right direction?

-Roberto



Hi Roberto, I know your post is old, but I found that $HOME/.gitssh.sh contains dbclient -y -i ~/.ssh/id_rsa $\*
instead of dbclient -y -i ~/.ssh/id_rsa $*.
The asterisk is incorrectly escaped, the forward slash is not needed. Just vi t $HOME/.gitssh.sh and remove that slash.

The discussion might have continued from here.