歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux命令 >> Linux命令chattr和lsattr

Linux命令chattr和lsattr

日期:2017/2/28 9:58:25   编辑:Linux命令

先看字面解釋:

chattr:chattr - change file attributes on a Linux file system

lsattr - list file attributes on a Linux second extended file system

chattr命令用法:chattr [ -RVf ] [ -v version ] [ mode ] files…
[mode]部分由+-=和[ASacDdIijsTtu]組合的,用來控制文件的屬性。
參數查看,執行man chattr或者man lsattr
用途列舉:
1、禁止修改,添加用戶屬性
# chattr +i /etc/passwd
# lsattr /etc/passwd
會顯示如下屬性
----i------e- /etc/passwd
2、日志文件的保護:
# chattr +a /var/log/messages

Copyright © Linux教程網 All Rights Reserved