219mze 发表于 2024-8-22 14:46:24

Linux chattr 命令


    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/88155e328c384c91b371c5403c8235a5~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1724865453&amp;x-signature=2Ipamj5LrxKyJAr1wZ5plmdP7bg%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">介绍</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">更改Linux文件系统上的文件属性;</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">安装</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">yum -y install e2fsprogs</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">语法格式</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">chattr [-RVf] [-+=aAcCdDeijsStTu] [-v version] files...</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">选项/参数</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">-R:递归更改文件属性;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">-V:<span style="color: black;">表示</span>执行过程;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">-f:禁止<span style="color: black;">表示</span>错误信息;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">-v :设置文件或目录版本;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">-:关闭文件或目录该属性;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">+:开启文件或目录该属性;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">=:指定文件或目录该属性;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">属性模式:</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">a:让文件或目录仅供附加用途;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">b:不更新文件或目录的最后存取时间;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">c:将文件或目录压缩后存放;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">d:将文件或目录排除在倾倒操作之外;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">i:不得任意更改文件或目录;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">s:保密性删除文件或目录;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">S:即时更新文件或目录;</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">u:预防意外删除;</span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">示例</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">防止文件内容被意外更改</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">chattr +i /data/java/info.txt</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">查看特殊属性</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">lsattr</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">----i----------- ./info.txt</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">取消特殊属性</span></strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">chattr -i /data/java/info.txt</span></p>




7wu1wm0 发表于 2024-8-31 01:13:59

楼主的文章深得我心,表示由衷的感谢!

nqkk58 发表于 2024-10-4 04:15:36

楼主果然英明!不得不赞美你一下!

4lqedz 发表于 2024-10-18 05:56:36

楼主听话,多发外链好处多,快到碗里来!外链论坛 http://www.fok120.com/

qzmjef 发表于 2024-10-22 22:40:26

交流如星光璀璨,点亮思想夜空。
页: [1]
查看完整版本: Linux chattr 命令