linux 文件、目录写保护小技巧
[root@book ~]# chattr +i a.txt
[root@root ~]# rm -f a.txt
rm: cannot remove a.txt': Operation not permitted [root@book ~]# ls anaconda-ks.cfg a.txt Desktop install.log install.log.syslog [root@book ~]# chattr -i a.txt [root@book ~]# rm -f a.txt [root@book ~]# ls anaconda-ks.cfg Desktop install.log install.log.syslog 保护目录: [root@root root]# mkdir test [root@root root]# chattr +i test [root@root root]# rm -fr test rm: cannot remove directory test': Operation not permitted
一个小技巧 希望能帮到有用的童鞋