歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> chattr用法,chattr

chattr用法,chattr

日期:2017/3/3 17:59:34   编辑:學習Linux

chattr用法,chattr

chattr用法,chattr


  

[root@localhost tmp]# umask
0022

一、chattr用法

1、創建空文件attrtest,然後刪除,提示無法刪除,因為有隱藏文件

[root@localhost tmp]# cd /tmp

[root@localhost tmp]# touch attrtest
[root@localhost tmp]# chattr +i attrtest
[root@localhost tmp]# rm attrtest
rm: remove regular empty file ‘attrtest’? y
rm: cannot remove ‘attrtest’: Operation not permitted

2、將文件attrtest的隱藏屬性取消

[root@localhost tmp]# chattr -i attrtest
[root@localhost tmp]# ls
attrtest hsperfdata_root install ks-script-3CWMoc systemd-private-810f661cb5d247129113c096f86d7db2-cups.service-fEKfSx test2 testtouch vitest yum.log

3、刪除attrtest文件,發現可以刪除

[root@localhost tmp]# rm attrtest
rm: remove regular empty file ‘attrtest’? y
[root@localhost tmp]# ls
hsperfdata_root install ks-script-3CWMoc systemd-private-810f661cb5d247129113c096f86d7db2-cups.service-fEKfSx test2 testtouch vitest yum.log

http://xxxxxx/Linuxjc/1182081.html TechArticle

Copyright © Linux教程網 All Rights Reserved