我最近把.ssh目录弄乱了。我认为进行了一些权限更改,现在不再允许我访问它。我可以以root用户身份访问它(sudo -i),但不能以somesh身份访问
列出或提示进入.ssh时,我得到的权限被拒绝,即使它显示了文件
ls: cannot access /home/somesh/.ssh/amazon.pem: Permission denied
ls: cannot access /home/somesh/.ssh/id_rsa: Permission denied
ls: cannot access /home/somesh/.ssh/known_hosts: Permission denied
ls: cannot access /home/somesh/.ssh/id_rsa.pub: Permission denied
total 0
-????????? ? ? ? ? ? amazon.pem
-????????? ? ? ? ? ? id_rsa
-????????? ? ? ? ? ? id_rsa.pub
-????????? ? ? ? ? ? known_hosts
以root和ls登录具有以下结果
# ls -l /home/somesh/ -a |grep ssh
drw-rw-rw- 2 somesh somesh 4096 Aug 27 15:45 .ssh
甚至里面的文件都是.ssh都归somesh:somesh和chm拥有
-rw-rw-rw- 1 somesh somesh 1692 Aug 27 15:45 amazon.pem
-rw-rw-rw- 1 somesh somesh 1675 Aug 25 20:01 id_rsa
~/.ssh
目录的正确权限是700
(drwx------
)。