今天 系统出了问题 导致root 下 文件全部被删除,只剩下 #bash
恢复后,authorized_keys 文件不允许被操作
[root@test_dc_rpdns_com ~]# ssh-copy-id root@10.1.234.4
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/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
root@10.1.234.4's password:
sh: .ssh/authorized_keys: 权限不够
本机无法操作
[root@dp-uat ~]#chmod 600 .ssh/authorized_keys
chmod: 更改".ssh/authorized_keys" 的权限: 不允许的操作
查看权限,正常 600
[root@dp-uat ~]#ll .ssh
总用量 12
-rw------- 1 root root 388 3月 25 06:40 authorized_keys
-rw------- 1 root root 1675 3月 25 15:28 id_rsa
-rw-r--r-- 1 root root 393 3月 25 15:28 id_rsa.pub
无法被删除
[root@dp-uat ~]#rm -rf /root/.ssh/authorized_keys
rm: 无法删除"/root/.ssh/authorized_keys": 不允许的操作
修改后正常
[root@dp-uat .ssh]#chattr -i authorized_keys