Hidden file attributes chattr: Linux

the chattr
the chattr command is used to hide permission settings file in the format of "chattr [parameters] files."
chattr - chattr +

Effect parameter
i can not modify the file; if this parameter is set to the directory, only the file modified sub-content which can not create or delete files
a supplemental allow only (additional) content can not be overwritten / deleted content (Append Only)
S immediately after the change in the contents of the file to your hard disk synchronization (sync)
S completely deleted from the hard disk, unrecoverable (filled with zeros where the original file hard disk area)
a no longer modify the last access time of the file or directory (atime)
b no longer access time or modify the file directory
d checks errors in the compressed file
ignore this dump command file using the backup d / directory
c default file or directory is compressed
u when still retain the data in the hard disk after deleting the file, to facilitate the future recovery
t make the file system support tail-merging (tail-merging)
the X-can directly access the contents of compressed files

[root@master1-192-168-117-18 ~]# cat /etc/shadow > fan
[root@master1-192-168-117-18 ~]# chattr +a fan
[root@master1-192-168-117-18 ~]# echo "wohaofan" > fan
-bash: fan: 不允许的操作
[root@master1-192-168-117-18 ~]# echo "wohaofan" >> fan

lsattr

[root @ master1-192-168-117-18 ~] # lsattr
------------- e-- ./560_file
------------- e- - ./shadow.bak.bak
------------- e-- ./Example.sh
------------- e-- ./chkscore.sh
e-- ./mkcdrom.sh -------------
----- ------- e-- a ./fan
---------- e-- ./jiuming ---
------------- e-- ./ipadds.txt
------------- e-- ./chkhost. sh
------------- e-- ./example.sh
------------- e-- ./users.txt
------- e-- ./dead.letter ------
------------- e-- ./anaconda-ks.cfg
------------- e-- ./Guess.sh
------------- e-- ./profile.bak
------------- e-- ./profile.bak .tar.gz
------------- e-- ./linuxprobe
------------- e-- ./Checkkeys.sh
------ ------- e-- ./haha
and-- ./20191217 -------------
------------- and-- ./ChechHosts.sh

Guess you like

Origin blog.51cto.com/12400136/2461988