日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
CentOS下“ssh免密碼登錄不生效”問題

摘要

一般為了方便運(yùn)維管理都會(huì)配置ssh免密登錄,ssh免密登錄實(shí)現(xiàn)也很方便。今天遇到一個(gè)完成了配置了卻不能生效的問題。

思考

遇到這個(gè)問題一般有以下幾點(diǎn):

  • authorized_keys文件是否啟用
  • .ssh 和 authorized_keys 文件權(quán)限問題

排查

檢查AuthorizedKeysFile配置是否啟用authorized_keys

root@pts/1 $ cat /etc/ssh/sshd_config |egrep AuthorizedKeysFile
AuthorizedKeysFile    .ssh/authorized_keys

沒有問題,繼續(xù)檢查.ssh (700) 和 authorized_keys(644) 權(quán)限

root@pts/1 $ getfacl /root/.ssh/
getfacl: Removing leading '/' from absolute path names
# file: root/.ssh/
# owner: root
# group: root
user::rwx
group::---
other::---

root@pts/1 $ getfacl /root/.ssh/authorized_keys
getfacl: Removing leading '/' from absolute path names
# file: root/.ssh/authorized_keys
# owner: root
# group: root
user::rw-
group::---
other::---

authorized_keys 權(quán)限不對(duì),修改一下chmod 644 authorized_keys

再次嘗試結(jié)果發(fā)現(xiàn)還是不行。但是該設(shè)置的權(quán)限都設(shè)置了。既然.ssh目錄和其下文件的權(quán)限都OK了,那就檢查下其父目錄的權(quán)限,也就是這里的/root的權(quán)限

root@pts/1 $ getfacl /root/
getfacl: Removing leading '/' from absolute path names
# file: root/
# owner: ftpuser
# group: ftpuser
user::r-x
group::r-x
other::---

發(fā)現(xiàn)這里/root 的屬主都發(fā)生了變化。為了不影響別的業(yè)務(wù)情況,保留這里的ftpuser權(quán)限,利用setfacl添加特殊ACL權(quán)限

root@pts/1 $ chown -R root:root  /root/
root@pts/1 $ setfacl -m u:ftpuser:rwx /root/

root@pts/1 $ getfacl /root/
getfacl: Removing leading '/' from absolute path names
# file: root/
# owner: root
# group: root
user::rwx
user:ftpuser:rwx        #effective:r-x
group::r-x
mask::r-x
other::r-x

附加

  • 權(quán)限問題

    • /root 775
    • /root/.ssh 700
    • /root/.ssh/authorized_keys 644
  • 開啟文件AuthorizedKeysFile .ssh/authorized_keys


分享標(biāo)題:CentOS下“ssh免密碼登錄不生效”問題
URL網(wǎng)址:http://www.5511xx.com/article/dhdsjoj.html