Ansible亚马逊linux权限被拒绝(publickey)
问题描述:
我是新来的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).
有人能指导我解决这个问题。
答
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
嘿Jakuje,它的工作。非常感谢解决方法 – linuxkaran
请花点时间查看[tour](http://stackoverflow.com/tour)部分,了解如何接受解决您问题的问题。 – Jakuje