Home > Mobile >  Ubuntu & Github / SSH does not work anymore - "Permission denied (publicK=key)"
Ubuntu & Github / SSH does not work anymore - "Permission denied (publicK=key)"

Time:01-08

had set up SSH on Ubuntu WSL for two (school .edu & personal) github accounts. They worked, & I was able to make commits and clone repos from both accounts using

git config user.name/user.email

whenever I made a new repository.

I then installed GitLab for KDE.org, and I was able to fork a repo & authenticate my SSH.

Then, I'm not sure where things went wrong. I tried to modify my global config & typed a few stuff but changed my mind & force quit it (:q!). I restarted my laptop, then tried to go back to my personal account to push something - permission denied. I tried setting 700/600 permissions as one Ubuntu thread here & no luck.

Here is what my config file looks like:

...

#personal account
Host github.com-victoriaemily
    HostName github.com
    User victoriaemily
    IdentityFile ~/.ssh/victoriaemily
    IdentitiesOnly yes

.ssh dir

using: ssh -vT [email protected]

OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /home/victoriaemily/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to github.com [140.82.114.4] port 22.
debug1: Connection established.
debug1: identity file /home/victoriaemily/.ssh/id_rsa type -1
debug1: identity file /home/victoriaemily/.ssh/id_rsa-cert type -1
...
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
debug1: Remote protocol version 2.0, remote software version babeld-4ce3b487
debug1: no match: babeld-4ce3b487
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM
debug1: Host 'github.com' is known and matches the ECDSA host key.
debug1: Found key in /home/victoriaemily/.ssh/known_hosts:3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/victoriaemily/.ssh/id_rsa
debug1: Will attempt key: /home/victoriaemily/.ssh/id_dsa
...
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh...
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/victoriaemily/.ssh/id_rsa
debug1: Trying private key: /home/victoriaemily/.ssh/id_dsa
...
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).

I have tried generating new SSH keys for both Gitlab and Github - did not work. What should I do? Thanks. I am another SSH key away from reinstalling everything : ,)

CodePudding user response:

Host github.com-victoriaemily
    HostName github.com
    User victoriaemily
    IdentityFile ~/.ssh/victoriaemily
    IdentitiesOnly yes

vs

ssh -vT [email protected]

Your "Host" entry is for "github.com-victoriaemily". It doesn't match "github.com", so this host entry isn't used and ssh doesn't try to use the "victoriaemily" key.

If you want to use that host entry, you should run something like:

ssh -vT [email protected]
  • Related