[root@test temp]# touch attrtest
[root@test temp]# rm attrtest
rm: remove write-protected regular empty file `attrtest'? y
rm: cannot remove `attrtest': Operation not permitted
[root@test temp]# chattr -i attrtest
[root@test temp]# rm attrtest
rm: remove regular empty file `attrtest'? y
[root@test temp]#
由于这些属性是隐藏的性质,所以要以lsattr才能看到该属性。其中,最重要的当属+i 与 +a 这个属性了。+i 可以让一个文件无法被更动,对于需要强烈的系统安全的人来说,真是相当重要。里头还有相当多的属性需要root才能设置。
[root@test temp]# lsattr attrtest
------------- attrtest
[root@test temp]# chattr +aij attrtest
[root@test temp]# lsattr attrtest
----ia---j--- attrtest
[root@test temp]#
本文介绍如何利用chattr为文件设置不可更改属性(+i)及附加属性(+a, +j),并通过lsattr查看这些隐藏属性。对于系统安全至关重要。
736

被折叠的 条评论
为什么被折叠?



