前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >chattr测试

chattr测试

作者头像
全栈程序员站长
发布2022-11-16 18:06:52
7121
发布2022-11-16 18:06:52
举报
文章被收录于专栏:全栈程序员必看

chmod只是改变文件的读写、执行权限,更底层的属性控制是由chattr来改变的,chattr控制更细腻。

[root@localhost temp]# lsattr

————-e- ./workfile ————-e- ./2.txt lsattr: Operation not supported While reading flags on ./4.txt –chattr的i参数使文件不能修改与删除 [root@localhost temp]# chattr +i 2.txt

[root@localhost temp]# lsattr ————-e- ./workfile —-i——–e- ./2.txt lsattr: Operation not supported While reading flags on ./4.txt –不能删除 [root@localhost temp]# rm -f 2.txt rm: cannot remove `2.txt’: Operation not permitted –不能修改 [root@localhost temp]# echo aaa>2.txt bash: 2.txt: Permission denied –chattr的a属性使文件只能在末尾追加内容 [root@localhost temp]# chattr +a 2.txt [root@localhost temp]# lsattr ————-e- ./workfile —–a——-e- ./2.txt lsattr: Operation not supported While reading flags on ./4.txt –不能覆盖更新 [root@localhost temp]# echo aaa>2.txt bash: 2.txt: Operation not permitted –只能追加 [root@localhost temp]# echo aaa>>2.txt [root@localhost temp]# cat 2.txt aaa aaa

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/234518.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年11月2日 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档