2017-04-11 131 views
1

我是新來的ansible。試圖在amazon linux實例中配置它來學習有關ansible的基本知識。安裝完成後,我使用命令ssh-keygen創建了一個ssh密鑰對。一旦產生我試圖運行命令「SSH-複製ID本地主機」,但它與下面的錯誤結束,Ansible亞馬遜linux權限被拒絕(publickey)

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed 
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys 
Permission denied (publickey). 

有人能指導我解決這個問題。

回答

1
ssh-copy-id localhost 

如果您沒有在本地主機上的ssh服務器上啓用密碼認證,則該功能將不起作用。

如果您需要設置PUBKEY認證,不允許密碼驗證,只需複製本地的公鑰(因爲它爲localhost):

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 
chmod 700 ~/.ssh/ 
chmod 600 ~/.ssh/authorized_keys 
# make sure the SELinux labels are correct: 
type restorecon && restorecon -F .ssh .ssh/authorized_keys 
+0

嘿Jakuje,它的工作。非常感謝解決方法 – linuxkaran

+0

請花點時間查看[tour](http://stackoverflow.com/tour)部分,瞭解如何接受解決您問題的問題。 – Jakuje

相關問題