您的位置:首页 > 运维架构 > Linux

Linux命令chattr和lsattr

2017-05-18 16:28 232 查看
先看字面解释:

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: