Linux Operations note 20180001-File and directory management permissions

Source: Internet
Author: User
Tags chmod

This period of time to think a lot, although preparation for postgraduate examination, but the final purpose is to work, so every day will take one hours to consolidate the small knowledge of operation and maintenance. I think the teacher told me a sentence is right, smart people will do two things at the same time. I have no blind self-confidence, after all, time and energy is limited, fixed three points of knowledge every day, I will insist on doing well. My notes basically from the network finishing, as a college student, I think the issue of copyright is not negotiable, in reference to other people's article, I will put the address of others, so that more people see, salute uncle, to those on the road of the programmer salute.

1.umask file default permissions (0022)

(1) Root User: Default 022

Files:-rw-r--r--

Catalog: Drwxr-xr-x

(2) General users: 002

usage: #umask-S U=rwx,g=rx,o=rx

2. File hidden properties chattr, lsattr

Chattr "+-=" "Asacdistu" file or directory Name "set file Properties"

Parameter: + Represents the addition of a special parameter, = represents only the following parameters (overwrite)

A: This file can only add data, cannot delete or modify data (root user can set).

I: "Do not kill permission". Files cannot be deleted, renamed, Connected, or can be written to or added to data (root).

Lsattr "AdR" file or directory "view file properties"

Parameter:-A: The properties of the hidden file are also shown.

-D: Lists only the properties of the directory itself.

-R: Along with the properties of the directory subdirectory are exposed.

3. Special permissions for Files suid, SGID, Sbit

(1) SUID ==> owner's permission

A.suid is valid only for binary programs, not for Shell script or directory

B. The performer needs to have X permission on the program

C. The performer will have the permissions of the program owner (owner)

      

(2) SGID ==> Group permissions

A.sgid is valid only for binaries and can also be used in directories

B. The performer needs to have X permission on the program

C. The performer will have permissions for the program user group

(3) sbit sticky bit ==> other people

A.sbit only valid for directory

B. The performer needs to have W, x permissions on the directory, that is, permission to write.

C. When a user creates a file or directory under that directory, only himself and Root have the right to delete (their own) files, and in the same vein, they cannot delete others ' files.

Set suid, SGID, Sbit

corresponding 4 2 1 respectively

Example: Ls-l file "permissions to view Files"

chmod 4755 Test//Join has SUID permission

chmod 6755 Test//Permissions with Suid/sgid

chmod 1755 test//function with Sbit

chmod 7666 Test//has empty Suid/sgid permission performance as:--RWSRWSRWT

This chapter is taken from "Uncle Bird's private Cuisine Basics"

Linux Operations note 20180001-File and directory management permissions

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.