轉載自 http://laowafang.blog.51cto.com/251518/1364298
1.說明:
ssh無密碼用戶遠程登錄,一直以來使用是debian操作系統,對用戶目錄權限要求沒有關注過,生成了密鑰,放對位置直接就可以使用,今天測試ansible工具,用到了CentOS6.3發現它對目錄權限要求比較嚴格,本博文僅僅記錄一下本次權限修改操作。
2、操作記錄
(1)創建用戶: ansible
(2)修改sshd_config文件
# vi /etc/ssh/sshd_config //開啟以下內容
HostKey /etc/ssh/ssh_host_rsa_key
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
# /etc/init.d/sshd restart
(3)權限設置
# mkdir /home/ansible/.ssh
# chown -R ansible:ansible /home/ansible
# chmod 700 /home/ansible
# chmod 700 /home/ansible/.ssh
# chmod 644 /home/ansible/.ssh/authorized_keys //公鑰文件的所有權限
# chmod 600 /home/ansible/.ssh/id_rsa //私鑰文件的所有權限
### 可以測試遠程連接了……