文件属性
一共16个。最多使用就是i
加了i属性后,文件不可以删除,也不能修改。
lsattr
显示该文件的属性
[yf@localhost ~]$ lsattr c
----i----------- c
chattr
[yf@localhost ~]$ chattr +i c
chattr: Operation not permitted while setting flags on c
# 必须在root下面使用chattr 命令,和chown一样。
[root@localhost ~]$ chattr +i c
[yf@localhost ~]$ rm c
rm: remove write-protected regular empty file ‘c’? y
rm: cannot remove ‘c’: Operation not permitted
使用root去掉i属性,就能删除了
chattr -i c
rm c
作者:严锋 创建时间:2023-12-07 14:21
最后编辑:严锋 更新时间:2025-05-09 15:48
最后编辑:严锋 更新时间:2025-05-09 15:48