{"id":216155,"date":"2021-04-27T10:48:03","date_gmt":"2021-04-27T02:48:03","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=216155"},"modified":"2021-04-16T14:48:47","modified_gmt":"2021-04-16T06:48:47","slug":"linux-chattr","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-chattr.html","title":{"rendered":"Linux chattr\u547d\u4ee4\u8be6\u89e3"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u672c\u6587\u8be6\u7ec6\u8bb2\u89e3\u4e86Linux chattr\u547d\u4ee4\uff0c\u4e00\u8d77\u5f00\u770b\u770b\u5427\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n \u5e38\u89c1\u547d\u4ee4\u53c2\u6570<\/strong><\/div>\n A\uff1a\u5373Atime\uff0c\u544a\u8bc9\u7cfb\u7edf\u4e0d\u8981\u4fee\u6539\u5bf9\u8fd9\u4e2a\u6587\u4ef6\u7684\u6700\u540e\u8bbf\u95ee\u65f6\u95f4\u3002<\/p>\n S\uff1a\u5373Sync\uff0c\u4e00\u65e6\u5e94\u7528\u7a0b\u5e8f\u5bf9\u8fd9\u4e2a\u6587\u4ef6\u6267\u884c\u4e86\u5199\u64cd\u4f5c\uff0c\u4f7f\u7cfb\u7edf\u7acb\u523b\u628a\u4fee\u6539\u7684\u7ed3\u679c\u5199\u5230\u78c1\u76d8\u3002<\/p>\n a\uff1a\u5373Append Only\uff0c\u7cfb\u7edf\u53ea\u5141\u8bb8\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e4b\u540e\u8ffd\u52a0\u6570\u636e\uff0c\u4e0d\u5141\u8bb8\u4efb\u4f55\u8fdb\u7a0b\u8986\u76d6\u6216\u622a\u65ad\u8fd9\u4e2a\u6587\u4ef6\u3002\u5982\u679c\u76ee\u5f55\u5177\u6709\u8fd9\u4e2a\u5c5e\u6027\uff0c\u7cfb\u7edf\u5c06\u53ea\u5141\u8bb8\u5728\u8fd9\u4e2a\u76ee\u5f55\u4e0b\u5efa\u7acb\u548c\u4fee\u6539\u6587\u4ef6\uff0c\u800c\u4e0d\u5141\u8bb8\u5220\u9664\u4efb\u4f55\u6587\u4ef6\u3002<\/p>\n b\uff1a\u4e0d\u66f4\u65b0\u6587\u4ef6\u6216\u76ee\u5f55\u7684\u6700\u540e\u5b58\u53d6\u65f6\u95f4\u3002<\/p>\n c\uff1a\u5c06\u6587\u4ef6\u6216\u76ee\u5f55\u538b\u7f29\u540e\u5b58\u653e\u3002<\/p>\n d\uff1a\u5f53dump\u7a0b\u5e8f\u6267\u884c\u65f6\uff0c\u8be5\u6587\u4ef6\u6216\u76ee\u5f55\u4e0d\u4f1a\u88abdump\u5907\u4efd\u3002<\/p>\n D:\u68c0\u67e5\u538b\u7f29\u6587\u4ef6\u4e2d\u7684\u9519\u8bef\u3002<\/p>\n i\uff1a\u5373Immutable\uff0c\u7cfb\u7edf\u4e0d\u5141\u8bb8\u5bf9\u8fd9\u4e2a\u6587\u4ef6\u8fdb\u884c\u4efb\u4f55\u7684\u4fee\u6539\u3002\u5982\u679c\u76ee\u5f55\u5177\u6709\u8fd9\u4e2a\u5c5e\u6027\uff0c\u90a3\u4e48\u4efb\u4f55\u7684\u8fdb\u7a0b\u53ea\u80fd\u4fee\u6539\u76ee\u5f55\u4e4b\u4e0b\u7684\u6587\u4ef6\uff0c\u4e0d\u5141\u8bb8\u5efa\u7acb\u548c\u5220\u9664\u6587\u4ef6\u3002<\/p>\n s\uff1a\u5f7b\u5e95\u5220\u9664\u6587\u4ef6\uff0c\u4e0d\u53ef\u6062\u590d\uff0c\u56e0\u4e3a\u662f\u4ece\u78c1\u76d8\u4e0a\u5220\u9664\uff0c\u7136\u540e\u75280\u586b\u5145\u6587\u4ef6\u6240\u5728\u533a\u57df\u3002<\/p>\n u\uff1a\u5f53\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u8bf7\u6c42\u5220\u9664\u8fd9\u4e2a\u6587\u4ef6\uff0c\u7cfb\u7edf\u4f1a\u4fdd\u7559\u5176\u6570\u636e\u5757\u4ee5\u4fbf\u4ee5\u540e\u80fd\u591f\u6062\u590d\u5220\u9664\u8fd9\u4e2a\u6587\u4ef6\uff0c\u7528\u6765\u9632\u6b62\u610f\u5916\u5220\u9664\u6587\u4ef6\u6216\u76ee\u5f55\u3002<\/p>\n t:\u6587\u4ef6\u7cfb\u7edf\u652f\u6301\u5c3e\u90e8\u5408\u5e76\uff08tail-merging\uff09\u3002<\/p>\n X\uff1a\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u538b\u7f29\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n \u5e38\u7528\u7684\u547d\u4ee4\u5c55\u793a<\/strong><\/div>\n chatter: \u9501\u5b9a\u6587\u4ef6\uff0c\u4e0d\u80fd\u5220\u9664\uff0c\u4e0d\u80fd\u66f4\u6539<\/p>\n +a: \u53ea\u80fd\u7ed9\u6587\u4ef6\u6dfb\u52a0\u5185\u5bb9\uff0c\u4f46\u662f\u5220\u9664\u4e0d\u4e86\uff0c<\/p>\n chattr +a \/etc\/passwd<\/p>\n -d: \u4e0d\u53ef\u5220\u9664<\/p>\n \u52a0\u9501\uff1achattr +i \/etc\/passwd \u6587\u4ef6\u4e0d\u80fd\u5220\u9664\uff0c\u4e0d\u80fd\u66f4\u6539\uff0c\u4e0d\u80fd\u79fb\u52a8<\/p>\n \u67e5\u770b\u52a0\u9501\uff1alsattr \/etc\/passwd \u6587\u4ef6\u52a0\u4e86\u4e00\u4e2a\u53c2\u6570 i \u8868\u793a\u9501\u5b9a<\/p>\n \u89e3\u9501\uff1achattr -i \/home\/jiaxu\/test.txt - \u8868\u793a\u89e3\u9664<\/p>\n \u9690\u85cfchattr\u547d\u4ee4\uff1a<\/strong><\/div>\n which chattr\r\nmv \/usr\/bin\/chattr\u00a0 \/opt\/ftl\/\r\ncd \/opt\/ftl\/\r\nmv chattr h\u00a0 \u00a0 -->\u66f4\u6539\u547d\u4ee4\uff0c\u4f7f\u7528\u522b\u540dh\u9690\u85cf\u8eab\u4efd\r\n\/opt\/ftl\/h +i \/home\/jiaxu\/test.txt\u00a0 \u00a0-->\u5229\u7528h \u884c\u9a76chattr\u547d\u4ee4\r\nlsattr \/home\/jiaxu\/test.txt\u00a0 \u00a0 -->\u67e5\u770b\u52a0\u5bc6\u4fe1\u606f<\/pre>\n |