CenOS6.3 ssh 公鑰認證報錯:Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

Ready!發表於2016-08-23

轉載自 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        //私鑰檔案的所有許可權

### 可以測試遠端連線了……

相關文章