GitLab SSH Keys - Permission denied (publickey)










1














I followed this document to setup my SSH authentication https://kgcoe-git.rit.edu/help/ssh/README#generating-a-new-ssh-key-pair



It has worked before but this time on a new setup I get Permission denied (publickey) error



Below is the debug output from the ssh command



ankushko@node-0:~/Code$ sudo ssh -vT git@pc3.instageni.utc.edu
OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).


Keys



ankushko@node-0:~$ sudo ls ~/.ssh/
authorized_keys id_rsa id_rsa.pub known_hosts


Update: Tried without sudo



ankushko@node-0:~$ ssh -vT git@pc3.instageni.utc.edu
OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
debug1: Connection established.
debug1: identity file /users/ankushko/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /users/ankushko/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /users/ankushko/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /users/ankushko/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /users/ankushko/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /users/ankushko/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /users/ankushko/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /users/ankushko/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
debug1: Found key in /users/ankushko/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /users/ankushko/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /users/ankushko/.ssh/id_dsa
debug1: Trying private key: /users/ankushko/.ssh/id_ecdsa
debug1: Trying private key: /users/ankushko/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).


Thanks in advance.










share|improve this question




























    1














    I followed this document to setup my SSH authentication https://kgcoe-git.rit.edu/help/ssh/README#generating-a-new-ssh-key-pair



    It has worked before but this time on a new setup I get Permission denied (publickey) error



    Below is the debug output from the ssh command



    ankushko@node-0:~/Code$ sudo ssh -vT git@pc3.instageni.utc.edu
    OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
    debug1: Connection established.
    debug1: permanently_set_uid: 0/0
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_rsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/id_ed25519-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
    debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
    debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
    debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: algorithm: curve25519-sha256@libssh.org
    debug1: kex: host key algorithm: rsa-sha2-512
    debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
    debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
    debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
    debug1: Found key in /root/.ssh/known_hosts:1
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_EXT_INFO received
    debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Trying private key: /root/.ssh/id_rsa
    debug1: Trying private key: /root/.ssh/id_dsa
    debug1: Trying private key: /root/.ssh/id_ecdsa
    debug1: Trying private key: /root/.ssh/id_ed25519
    debug1: No more authentication methods to try.
    Permission denied (publickey).


    Keys



    ankushko@node-0:~$ sudo ls ~/.ssh/
    authorized_keys id_rsa id_rsa.pub known_hosts


    Update: Tried without sudo



    ankushko@node-0:~$ ssh -vT git@pc3.instageni.utc.edu
    OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
    debug1: Connection established.
    debug1: identity file /users/ankushko/.ssh/id_rsa type 1
    debug1: key_load_public: No such file or directory
    debug1: identity file /users/ankushko/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /users/ankushko/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /users/ankushko/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /users/ankushko/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /users/ankushko/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /users/ankushko/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /users/ankushko/.ssh/id_ed25519-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
    debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
    debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
    debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: algorithm: curve25519-sha256@libssh.org
    debug1: kex: host key algorithm: rsa-sha2-512
    debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
    debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
    debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
    debug1: Found key in /users/ankushko/.ssh/known_hosts:1
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_EXT_INFO received
    debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Offering RSA public key: /users/ankushko/.ssh/id_rsa
    debug1: Authentications that can continue: publickey
    debug1: Trying private key: /users/ankushko/.ssh/id_dsa
    debug1: Trying private key: /users/ankushko/.ssh/id_ecdsa
    debug1: Trying private key: /users/ankushko/.ssh/id_ed25519
    debug1: No more authentication methods to try.
    Permission denied (publickey).


    Thanks in advance.










    share|improve this question


























      1












      1








      1


      1





      I followed this document to setup my SSH authentication https://kgcoe-git.rit.edu/help/ssh/README#generating-a-new-ssh-key-pair



      It has worked before but this time on a new setup I get Permission denied (publickey) error



      Below is the debug output from the ssh command



      ankushko@node-0:~/Code$ sudo ssh -vT git@pc3.instageni.utc.edu
      OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 19: Applying options for *
      debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
      debug1: Connection established.
      debug1: permanently_set_uid: 0/0
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_rsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_rsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_dsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_dsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ecdsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ecdsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ed25519 type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ed25519-cert type -1
      debug1: Enabling compatibility mode for protocol 2.0
      debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
      debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
      debug1: SSH2_MSG_KEXINIT sent
      debug1: SSH2_MSG_KEXINIT received
      debug1: kex: algorithm: curve25519-sha256@libssh.org
      debug1: kex: host key algorithm: rsa-sha2-512
      debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
      debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
      debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
      debug1: Found key in /root/.ssh/known_hosts:1
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS sent
      debug1: expecting SSH2_MSG_NEWKEYS
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS received
      debug1: SSH2_MSG_EXT_INFO received
      debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
      debug1: SSH2_MSG_SERVICE_ACCEPT received
      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Trying private key: /root/.ssh/id_rsa
      debug1: Trying private key: /root/.ssh/id_dsa
      debug1: Trying private key: /root/.ssh/id_ecdsa
      debug1: Trying private key: /root/.ssh/id_ed25519
      debug1: No more authentication methods to try.
      Permission denied (publickey).


      Keys



      ankushko@node-0:~$ sudo ls ~/.ssh/
      authorized_keys id_rsa id_rsa.pub known_hosts


      Update: Tried without sudo



      ankushko@node-0:~$ ssh -vT git@pc3.instageni.utc.edu
      OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 19: Applying options for *
      debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
      debug1: Connection established.
      debug1: identity file /users/ankushko/.ssh/id_rsa type 1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_rsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_dsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_dsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ecdsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ecdsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ed25519 type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ed25519-cert type -1
      debug1: Enabling compatibility mode for protocol 2.0
      debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
      debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
      debug1: SSH2_MSG_KEXINIT sent
      debug1: SSH2_MSG_KEXINIT received
      debug1: kex: algorithm: curve25519-sha256@libssh.org
      debug1: kex: host key algorithm: rsa-sha2-512
      debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
      debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
      debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
      debug1: Found key in /users/ankushko/.ssh/known_hosts:1
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS sent
      debug1: expecting SSH2_MSG_NEWKEYS
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS received
      debug1: SSH2_MSG_EXT_INFO received
      debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
      debug1: SSH2_MSG_SERVICE_ACCEPT received
      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Offering RSA public key: /users/ankushko/.ssh/id_rsa
      debug1: Authentications that can continue: publickey
      debug1: Trying private key: /users/ankushko/.ssh/id_dsa
      debug1: Trying private key: /users/ankushko/.ssh/id_ecdsa
      debug1: Trying private key: /users/ankushko/.ssh/id_ed25519
      debug1: No more authentication methods to try.
      Permission denied (publickey).


      Thanks in advance.










      share|improve this question















      I followed this document to setup my SSH authentication https://kgcoe-git.rit.edu/help/ssh/README#generating-a-new-ssh-key-pair



      It has worked before but this time on a new setup I get Permission denied (publickey) error



      Below is the debug output from the ssh command



      ankushko@node-0:~/Code$ sudo ssh -vT git@pc3.instageni.utc.edu
      OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 19: Applying options for *
      debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
      debug1: Connection established.
      debug1: permanently_set_uid: 0/0
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_rsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_rsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_dsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_dsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ecdsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ecdsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ed25519 type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /root/.ssh/id_ed25519-cert type -1
      debug1: Enabling compatibility mode for protocol 2.0
      debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
      debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
      debug1: SSH2_MSG_KEXINIT sent
      debug1: SSH2_MSG_KEXINIT received
      debug1: kex: algorithm: curve25519-sha256@libssh.org
      debug1: kex: host key algorithm: rsa-sha2-512
      debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
      debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
      debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
      debug1: Found key in /root/.ssh/known_hosts:1
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS sent
      debug1: expecting SSH2_MSG_NEWKEYS
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS received
      debug1: SSH2_MSG_EXT_INFO received
      debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
      debug1: SSH2_MSG_SERVICE_ACCEPT received
      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Trying private key: /root/.ssh/id_rsa
      debug1: Trying private key: /root/.ssh/id_dsa
      debug1: Trying private key: /root/.ssh/id_ecdsa
      debug1: Trying private key: /root/.ssh/id_ed25519
      debug1: No more authentication methods to try.
      Permission denied (publickey).


      Keys



      ankushko@node-0:~$ sudo ls ~/.ssh/
      authorized_keys id_rsa id_rsa.pub known_hosts


      Update: Tried without sudo



      ankushko@node-0:~$ ssh -vT git@pc3.instageni.utc.edu
      OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
      debug1: Reading configuration data /etc/ssh/ssh_config
      debug1: /etc/ssh/ssh_config line 19: Applying options for *
      debug1: Connecting to pc3.instageni.utc.edu [150.182.135.23] port 22.
      debug1: Connection established.
      debug1: identity file /users/ankushko/.ssh/id_rsa type 1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_rsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_dsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_dsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ecdsa type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ecdsa-cert type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ed25519 type -1
      debug1: key_load_public: No such file or directory
      debug1: identity file /users/ankushko/.ssh/id_ed25519-cert type -1
      debug1: Enabling compatibility mode for protocol 2.0
      debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
      debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.4 pat OpenSSH* compat 0x04000000
      debug1: Authenticating to pc3.instageni.utc.edu:22 as 'git'
      debug1: SSH2_MSG_KEXINIT sent
      debug1: SSH2_MSG_KEXINIT received
      debug1: kex: algorithm: curve25519-sha256@libssh.org
      debug1: kex: host key algorithm: rsa-sha2-512
      debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
      debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
      debug1: Server host key: ssh-rsa SHA256:BUPmhA1nWbH8Zq0cg4uohS3L/Vo4uOZ8PLrdUYf3ano
      debug1: Host 'pc3.instageni.utc.edu' is known and matches the RSA host key.
      debug1: Found key in /users/ankushko/.ssh/known_hosts:1
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS sent
      debug1: expecting SSH2_MSG_NEWKEYS
      debug1: rekey after 134217728 blocks
      debug1: SSH2_MSG_NEWKEYS received
      debug1: SSH2_MSG_EXT_INFO received
      debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
      debug1: SSH2_MSG_SERVICE_ACCEPT received
      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Offering RSA public key: /users/ankushko/.ssh/id_rsa
      debug1: Authentications that can continue: publickey
      debug1: Trying private key: /users/ankushko/.ssh/id_dsa
      debug1: Trying private key: /users/ankushko/.ssh/id_ecdsa
      debug1: Trying private key: /users/ankushko/.ssh/id_ed25519
      debug1: No more authentication methods to try.
      Permission denied (publickey).


      Thanks in advance.







      ssh gitlab ssh-keys






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 3:15

























      asked Nov 11 at 16:30









      Ankush Kaul

      62




      62






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The command:



          sudo ssh -vT git@pc3.instageni.utc.edu


          is running as root and will use /root/.ssh/config and a private ssh key from that same directory, e.g. /root/.ssh/id_rsa. In the command:



          sudo ls ~/.ssh/


          the shell, probably bash, will expand ~ to your home directory before it even calls sudo (prove this with sudo echo ~), so it will display files from your home directory, probably /home/ankushko.



          Can I ask why you are running these command with sudo? Would it work to just connect as a normal user? That would be more secure, but sometimes there is a need to run things as root.



          Either way, you need to make sure the private ssh key that you are actually using matches the public ssh key on the server.






          share|improve this answer




















          • Also its worth mentioning that checking for whether there's a key on the agent as well ssh-add -l. Since not all systems load the private key to the agent by default for security reasons.
            – Praveen P
            Nov 11 at 19:55











          • I used sudo because I thought I needed root permissions to access the ssh keys, but I was wrong. But I still get the error when I dont use sudo.
            – Ankush Kaul
            Nov 12 at 3:12










          • Updated my quesion
            – Ankush Kaul
            Nov 12 at 3:12










          • I created new keys as per the link above, is there a way to check if the private and public keys match?
            – Ankush Kaul
            Nov 12 at 3:18










          • Verify that they are a pair with ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub (replace id_rsa with your filename). This will display the public key contained within your private key, and then the 2nd part will display your actual public key. Check visually if they match (ignoring user@host at the end of the public key--this is just a comment).
            – bitinerant
            Nov 12 at 8:38










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250785%2fgitlab-ssh-keys-permission-denied-publickey%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The command:



          sudo ssh -vT git@pc3.instageni.utc.edu


          is running as root and will use /root/.ssh/config and a private ssh key from that same directory, e.g. /root/.ssh/id_rsa. In the command:



          sudo ls ~/.ssh/


          the shell, probably bash, will expand ~ to your home directory before it even calls sudo (prove this with sudo echo ~), so it will display files from your home directory, probably /home/ankushko.



          Can I ask why you are running these command with sudo? Would it work to just connect as a normal user? That would be more secure, but sometimes there is a need to run things as root.



          Either way, you need to make sure the private ssh key that you are actually using matches the public ssh key on the server.






          share|improve this answer




















          • Also its worth mentioning that checking for whether there's a key on the agent as well ssh-add -l. Since not all systems load the private key to the agent by default for security reasons.
            – Praveen P
            Nov 11 at 19:55











          • I used sudo because I thought I needed root permissions to access the ssh keys, but I was wrong. But I still get the error when I dont use sudo.
            – Ankush Kaul
            Nov 12 at 3:12










          • Updated my quesion
            – Ankush Kaul
            Nov 12 at 3:12










          • I created new keys as per the link above, is there a way to check if the private and public keys match?
            – Ankush Kaul
            Nov 12 at 3:18










          • Verify that they are a pair with ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub (replace id_rsa with your filename). This will display the public key contained within your private key, and then the 2nd part will display your actual public key. Check visually if they match (ignoring user@host at the end of the public key--this is just a comment).
            – bitinerant
            Nov 12 at 8:38















          0














          The command:



          sudo ssh -vT git@pc3.instageni.utc.edu


          is running as root and will use /root/.ssh/config and a private ssh key from that same directory, e.g. /root/.ssh/id_rsa. In the command:



          sudo ls ~/.ssh/


          the shell, probably bash, will expand ~ to your home directory before it even calls sudo (prove this with sudo echo ~), so it will display files from your home directory, probably /home/ankushko.



          Can I ask why you are running these command with sudo? Would it work to just connect as a normal user? That would be more secure, but sometimes there is a need to run things as root.



          Either way, you need to make sure the private ssh key that you are actually using matches the public ssh key on the server.






          share|improve this answer




















          • Also its worth mentioning that checking for whether there's a key on the agent as well ssh-add -l. Since not all systems load the private key to the agent by default for security reasons.
            – Praveen P
            Nov 11 at 19:55











          • I used sudo because I thought I needed root permissions to access the ssh keys, but I was wrong. But I still get the error when I dont use sudo.
            – Ankush Kaul
            Nov 12 at 3:12










          • Updated my quesion
            – Ankush Kaul
            Nov 12 at 3:12










          • I created new keys as per the link above, is there a way to check if the private and public keys match?
            – Ankush Kaul
            Nov 12 at 3:18










          • Verify that they are a pair with ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub (replace id_rsa with your filename). This will display the public key contained within your private key, and then the 2nd part will display your actual public key. Check visually if they match (ignoring user@host at the end of the public key--this is just a comment).
            – bitinerant
            Nov 12 at 8:38













          0












          0








          0






          The command:



          sudo ssh -vT git@pc3.instageni.utc.edu


          is running as root and will use /root/.ssh/config and a private ssh key from that same directory, e.g. /root/.ssh/id_rsa. In the command:



          sudo ls ~/.ssh/


          the shell, probably bash, will expand ~ to your home directory before it even calls sudo (prove this with sudo echo ~), so it will display files from your home directory, probably /home/ankushko.



          Can I ask why you are running these command with sudo? Would it work to just connect as a normal user? That would be more secure, but sometimes there is a need to run things as root.



          Either way, you need to make sure the private ssh key that you are actually using matches the public ssh key on the server.






          share|improve this answer












          The command:



          sudo ssh -vT git@pc3.instageni.utc.edu


          is running as root and will use /root/.ssh/config and a private ssh key from that same directory, e.g. /root/.ssh/id_rsa. In the command:



          sudo ls ~/.ssh/


          the shell, probably bash, will expand ~ to your home directory before it even calls sudo (prove this with sudo echo ~), so it will display files from your home directory, probably /home/ankushko.



          Can I ask why you are running these command with sudo? Would it work to just connect as a normal user? That would be more secure, but sometimes there is a need to run things as root.



          Either way, you need to make sure the private ssh key that you are actually using matches the public ssh key on the server.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 19:38









          bitinerant

          563




          563











          • Also its worth mentioning that checking for whether there's a key on the agent as well ssh-add -l. Since not all systems load the private key to the agent by default for security reasons.
            – Praveen P
            Nov 11 at 19:55











          • I used sudo because I thought I needed root permissions to access the ssh keys, but I was wrong. But I still get the error when I dont use sudo.
            – Ankush Kaul
            Nov 12 at 3:12










          • Updated my quesion
            – Ankush Kaul
            Nov 12 at 3:12










          • I created new keys as per the link above, is there a way to check if the private and public keys match?
            – Ankush Kaul
            Nov 12 at 3:18










          • Verify that they are a pair with ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub (replace id_rsa with your filename). This will display the public key contained within your private key, and then the 2nd part will display your actual public key. Check visually if they match (ignoring user@host at the end of the public key--this is just a comment).
            – bitinerant
            Nov 12 at 8:38
















          • Also its worth mentioning that checking for whether there's a key on the agent as well ssh-add -l. Since not all systems load the private key to the agent by default for security reasons.
            – Praveen P
            Nov 11 at 19:55











          • I used sudo because I thought I needed root permissions to access the ssh keys, but I was wrong. But I still get the error when I dont use sudo.
            – Ankush Kaul
            Nov 12 at 3:12










          • Updated my quesion
            – Ankush Kaul
            Nov 12 at 3:12










          • I created new keys as per the link above, is there a way to check if the private and public keys match?
            – Ankush Kaul
            Nov 12 at 3:18










          • Verify that they are a pair with ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub (replace id_rsa with your filename). This will display the public key contained within your private key, and then the 2nd part will display your actual public key. Check visually if they match (ignoring user@host at the end of the public key--this is just a comment).
            – bitinerant
            Nov 12 at 8:38















          Also its worth mentioning that checking for whether there's a key on the agent as well ssh-add -l. Since not all systems load the private key to the agent by default for security reasons.
          – Praveen P
          Nov 11 at 19:55





          Also its worth mentioning that checking for whether there's a key on the agent as well ssh-add -l. Since not all systems load the private key to the agent by default for security reasons.
          – Praveen P
          Nov 11 at 19:55













          I used sudo because I thought I needed root permissions to access the ssh keys, but I was wrong. But I still get the error when I dont use sudo.
          – Ankush Kaul
          Nov 12 at 3:12




          I used sudo because I thought I needed root permissions to access the ssh keys, but I was wrong. But I still get the error when I dont use sudo.
          – Ankush Kaul
          Nov 12 at 3:12












          Updated my quesion
          – Ankush Kaul
          Nov 12 at 3:12




          Updated my quesion
          – Ankush Kaul
          Nov 12 at 3:12












          I created new keys as per the link above, is there a way to check if the private and public keys match?
          – Ankush Kaul
          Nov 12 at 3:18




          I created new keys as per the link above, is there a way to check if the private and public keys match?
          – Ankush Kaul
          Nov 12 at 3:18












          Verify that they are a pair with ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub (replace id_rsa with your filename). This will display the public key contained within your private key, and then the 2nd part will display your actual public key. Check visually if they match (ignoring user@host at the end of the public key--this is just a comment).
          – bitinerant
          Nov 12 at 8:38




          Verify that they are a pair with ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub (replace id_rsa with your filename). This will display the public key contained within your private key, and then the 2nd part will display your actual public key. Check visually if they match (ignoring user@host at the end of the public key--this is just a comment).
          – bitinerant
          Nov 12 at 8:38

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250785%2fgitlab-ssh-keys-permission-denied-publickey%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo