linux[basic]-20-user and file permissions-[File hidden permissions]-[02]

Source: Internet
Author: User

Hidden Permissions for files

The permissions of a file have a special permission in addition to reading , writing , and SUID,SGID,sbit .

For example: you have permission to delete a file and cannot delete it, or you can only

To append content to a file and not to reduce or modify it, this will

Suspected of being attached with hidden permissions

chattr command to set hidden permissions for a file

Format:chattr [parameter] file

Parameters

Role

I

will not be able to modify the file, if the directory modified only can be modified but not new \ Delete

A

Allow append only (append), cannot overwrite, delete (append only)

S

Sync to hard drive immediately after file contents are modified

S

Completely removed from the hard drive, unrecoverable (with 0 filling the area of the hard disk where the original file resides)

A

The last access time for this file is not modified (atime)

B

Do not modify the file or directory access time

D

Check for errors in compressed files

D

Ignore this file/directory when using the dump command backup

C

The default is to compress files/directories

U

Save data on your hard drive after deleting this file for easy recovery

T

Let file system support trailer merge (tail-merging)

X

The contents of the compressed file can be accessed directly

lsattr command to display hidden permissions for a file

Format:lsattr [parameter] file

Parameters

Role

A

Show All files and directories

L

Displays the full name of the hidden property (the default is the abbreviated letter)

R

Recursive processing (processing all files and subdirectories under the specified directory)

D

If the target is a directory, add this parameter

Instance:

[Email protected] test1]#

[Email protected] test1]# echo "for test" > Test #创建一个文件

[Email protected] test1]# RM Test #删除

Rm:remove regular file ' test '? Y

[Email protected] test1]# echo "for test" > Test #在创建一个文件

[[email protected] test1]# chattr +a test #附加一个隐藏权限 (append only)

[[Email protected] test1]# RM test #删除, display cannot be deleted

Rm:remove regular file ' test '? Y

Rm:cannot remove ' test ': Operation not permitted

[Email protected] test1]# ll-a test #ls See nothing unusual

-rw-r--r--. 1 root root 9 Sep 15:58 test

[[email protected] test1]# lsattr-a test #lsattr view hidden permissions

-----a----------Test

[[email protected] test1]# chattr-a test #chattr Remove Permissions

[[Email protected] test1]# RM test #删除, and found can delete

Rm:remove regular file ' test '? Y

[[email protected] test1]# ls

[Email protected] test1]#

linux[Basic]-20-User and file permissions--[File hidden permissions]-[02]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.