Ssh key error "Host key verification failed."

Hello Garuda users.

I am facing a problem while trying to connect my Github with ssh key’s.

these steps are done successfully…

ssh-keygen -t ed25519 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub

Copying the key and added it to github…
but when i run …

ssh -T [email protected]

i got this error…

ssh_askpass: exec(/usr/bin/ksshaskpass): No such file or directory
Host key verification failed.

i am setting the ssh for first time…
and couldn’t found any reference related to this issue…
i followed this:
connecting-to-github-with-sshConnecting to GitHub with SSH - GitHub Docs

I remember a similar issue on forum that was resolved by removing ksshaskpass package. I don’t have this package myself and stuff works. :+1:

sudo pacman -Rns ksshaskpass

Here for more info

1 Like

what it that?
no,
This is not installed in my desktop

I just edited my reply please look in the link attached.

wait, i installed "ksshaskpass" .. now it works..IDK why :slightly_smiling_face:
and i want to know why..

ssh -T [email protected]
Hi Shnku! You've successfully authenticated, but GitHub does not provide shell access.

:slightly_smiling_face: now tell me why? what is ksshaskpass?

solution: INSTALLING "KSSHASKPASS" FIXED IT
other sollution: stop-ssh-from-using-ksshaskpass-or-any-popup/26678

ksshaskpass basically stores your ssh passwords. I remember someone here had an issue that they accidentally fed ksshaskpass wrong password for their server and couldn't connect to it anymore with a similar error to yours. Hence I found the post that resolved the issue for them. However if you are happy with the software go ahead and use it.

should i use ksshaskpass or not..any suggation?

Yup, time to get rid of it. Enough people were confused about this :face_with_monocle:

2 Likes

My general rule of thumb is if it ain’t broke don’t fix it. If it works for you why bother going about removing it. Just like plymouth it works for some it doesn’t for others. BTW,

about this. You might wanna take a look at archwiki and add the script in your .bashrc or .config/fish/config.fish depending on which shell you are using by default so that you can use the same instance of ssh-agent across multiple terminal emulators and have only one instance of ssh-agent running.

https://wiki.archlinux.org/title/SSH_keys#ssh-agent

for bash

if ! pgrep -u "$USER" ssh-agent > /dev/null; then
    ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! -f "$SSH_AUTH_SOCK" ]]; then
    source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
fi

for config.fish

if ! pgrep -u "$USER" ssh-agent > /dev/null;
ssh-agent -c -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env"
end
if [ ! -f "$SSH_AUTH_SOCK" ];
source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null
end

Remember you can’t have it in both choose one. Since placing this script in both would just issue errors. Or you can change the location of ssh-agent environment file so that both bash and fish use separate instances of ssh-agent.

Following this you won’t have to run eval "$(ssh-agent -s)" ever again. You just need to add the ssh key to ssh-agent using ssh-add. Oh the script also uses -t 1h which asks ssh-agent to keep the ssh password for 1h and then you need to add it again to ssh-agent if you wanna use it. You can remove this flag and have ssh-agent remember your ssh password until reboots.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.