【问题标题】:Ansible amazon linux Permission denied (publickey)Ansible amazon linux 权限被拒绝(公钥)
【发布时间】:2017-09-07 04:27:10
【问题描述】:

我是 ansible 的新手。尝试在 amazon linux 实例中配置它以了解有关 ansible 的基本知识。在 ansible 安装之后,我使用命令 ssh-keygen 创建了一个 ssh 密钥对。生成后,我尝试运行命令“ ssh-copy-id localhost”,但以以下错误结束,

/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).

谁能指导我解决这个问题。

【问题讨论】:

    标签: linux ssh ansible amazon-linux


    【解决方案1】:
    ssh-copy-id localhost
    

    如果您没有在 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,它成功了。非常感谢您的解决方法
    • 请花点时间查看tour 部分,了解如何接受解决您问题的问题。
    猜你喜欢
    • 2018-10-01
    • 2014-01-28
    • 2016-08-04
    • 2019-12-16
    • 1970-01-01
    • 2021-11-11
    • 1970-01-01
    • 2016-02-17
    • 2017-07-03
    相关资源
    最近更新 更多