linux 文件、目录写保护
文件:
[root@book ~]# touch a.txt
[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
[root@book ~]# touch a.txt
[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
顶(0)
踩(0)
- 最新评论
