Cloud Computing Learning Route course syllabus material: file attributes chattr
I'd like to share some information about the course outline of cloud computing learning route. This article is about the file attribute chattr. I hope I can give you some help:
File rights management: file attributes
Note: set file properties (permissions) for all users, including root
[root@tianyun ~] # touch file100 file200
[root@tianyun ~] # lsattr file100 file200
-e-file100
-e-file200
[root@tianyun ~] # man chattr att attribute
[root@tianyun ~] # chattr + a file100
[root@tianyun ~] # chattr + I file200
[root@tianyun ~] # lsattr file100 file200
-a mure-file100 a can only be appended but cannot be written
-iMure-file200
[root@tianyun ~] # echo 111 > file100 / / write in overwrite mode
Bash: file100: Operation not permitted
[root@tianyun ~] # rm-rf file100
Rm: cannot remove `file100': Operation not permitted
[root@tianyun ~] # echo 111 > > file100 / / write in an appended way, for example, log files are suitable for logs
[root@tianyun ~] # echo 111 > file200 I attribute cannot be changed for files applicable to / etc/suders / passwd files can only be viewed
Bash: file200: Permission denied
[root@instructor ~] # echo 111 > > file200
Bash: file200: Permission denied
[root@tianyun ~] # rm-rf file200
Rm: cannot remove `file200': Operation not permitted
[root@tianyun] # chattr-a file100
[root@tianyun] # chattr-I file200