Adding SSH Key to authorized_keys: permission denied(publickey)

与世无争的帅哥 提交于 2019-12-04 23:07:49

问题


  • I have an id_rsa and id_rsa.pub on my computer also tied into my BitBucket account.
  • As I understand I can use this public key anywhere I please (as long as my private matches).

The Problem: I cannot figure out how to get any server to accept the public key, do you see what I've done wrong?

 $ cat id_rsa.pub >> authorized_keys

 $ service ssh restart  (I suppose this isn't needed)

 $ git pull origin master

 $ Permission denied(publickey)

What am I doing wrong? I've been stuck for days.


回答1:


You need to copy the content of id_rsa.pub to the bitbucket avcount its in the settings page

For more info https://confluence.atlassian.com/display/BITBUCKET/How+to+install+a+public+key+on+your+Bitbucket+account




回答2:


If you copied your root's authorized_keys you may have to do more than you are used to:

chmod 700 .ssh
sudo chmod 640 .ssh/authorized_keys
sudo chown $USER .ssh
sudo chown $USER .ssh/authorized_keys

Where $USER is your linux username.




回答3:


Make sure the permissions on ~/.ssh are 700 i.e. only accessible by the owner, and the permissions on the public and private key files are not writable except by the owner.

Make sure the key files are in ~/.ssh !

Make sure the key is being used (try ssh'ing to the right user @ the bitbucket server using ssh -v)



来源:https://stackoverflow.com/questions/17821269/adding-ssh-key-to-authorized-keys-permission-deniedpublickey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!