Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

后端 未结 11 1061
有刺的猬
有刺的猬 2020-12-04 16:42

After creating the instance, I can login using gcutil or ssh. I tried copy/paste from the ssh link listed at the bottom of the instance and get the same error message.

相关标签:
11条回答
  • 2020-12-04 17:13

    You haven't accepted an answer, so here's what worked for me in PuTTY:

    enter image description here

    Without allowing username changes, i got this question's subject as error on the gateway machine.

    0 讨论(0)
  • 2020-12-04 17:16

    You need to follow this instructions https://cloud.google.com/compute/docs/instances/connecting-to-instance#generatesshkeypair

    If get "Permission denied (publickey)." with the follow command ssh -i ~/.ssh/my-ssh-key [USERNAME]@[IP_ADDRESS] you need to modify the /etc/ssh/sshd_config file and add the line AllowUsers [USERNAME]

    Then restart the ssh service with

    service ssh restart

    if you get the message "Could not load host key: /etc/ssh/ssh_host_ed25519_key" execute: ssh-keygen -A

    and finally restart the ssh service again.

    service ssh restart

    0 讨论(0)
  • 2020-12-04 17:17

    I was facing this issue for long time. Finally it was issue of ssh-add. Git ssh credentials were not taken into consideration.

    Check following command might work for you:

    ssh-add
    
    0 讨论(0)
  • 2020-12-04 17:17

    The trick here is to use the -C (comment) parameter to specify your GCE userid. It looks like Google introduced this change last in 2018.

    If the Google user who owns the GCE instance is myname@gmail.com (which you will use as your login userid), then generate the key pair with (for example)

    ssh-keygen -b521 -t ecdsa -C myname -f mykeypair
    

    When you paste mykeypair.pub into the instance's public key list, you should see "myname" appear as the userid of the key.

    Setting this up will let you use ssh, scp, etc from your command line.

    0 讨论(0)
  • 2020-12-04 17:18

    Ensure that the permissions on your home directory and on the home directory of the user on the host you're connecting to are set to 700 ( owning user rwx only to prevent others seeing the .ssh subdirectory ).

    Then ensure that the ~/.ssh directory is also 700 ( user rwx ) and that the authorized_keys is 600 ( user rw ) .

    Private keys in your ~/.ssh directory should be 600 or 400 ( user rw or user r )

    0 讨论(0)
提交回复
热议问题