Linux file Security and permissions

Source: Internet
Author: User

File



File type

Create a file

Change permission bit

Symbol mode

R W x: File owner Permission This is the previous three bits
R-x: Same group of user rights This is the middle three bits
R-x: Other user rights This is the last three bits
The general format of the chmod command is:
chmod [who] operator [permission] filename
Who's meaning is:
U file belongs to master permission
G Same group User rights
o Other user rights
A All users (file owner. Same group of users and other users)
The meaning of operator:
+ Add Permissions
-Cancel Permissions
= Set Permissions
The meaning of permission:
R Read Permissions
W Write permission
X Execute Permissions
S file owner and group Set-id
t Sticky bit *
L Give folder locks so that other users cannot access
Example:
Suppose the myfile file originally had such permissions: R W x
RWX rwx
Command result meaning
chmod a-x myfile rw-rw-rw-recover execution rights for all users
chmod og-w myfile rw-r–r--Recover Write permissions for the same group of users and other users
chmod g+w myfile rw-rw-r--Give write permission to the same group of users
chmod u+x myfile rwx rw-r--Give file owner execution permission
chmod go+x myfile rwx rwx r-x giving the same group of users and other users permission to execute

The general form of the chmod command absolute mode is:
chmod [mode] File
For example:
Command results
chmod 666 rw-rw-rw-
chmod 644 rw-r–r--
chmod 744 rwx r–r--
chmod 664 rw-rw-r--
chmod rwx--
chmod 444 r–r–r--
Chmod-r 664/usr/local/home/dave/* can set permissions together with the files in the word directory
Catalogue
R: You can list files in a directory W: You can create or delete files in a directory x: You can search or enter a directory
Examples of directory permissions:
Permission files belong to other users of the main group
DRWX rwx r-x (775) Read and write execution reading execution
Drwx r-x R – (754) read-write execution read
DRWX r-x r-x (755) Read and write execution read execution reading execution

Suid/guid

ls    ‘^...s..s‘//用来查找suid和guid文件的
How Suid and GUIDs are set

Example of setting Suid/guid


Chown and Chgrp

Chown and CHGRP examples

Find out which user group you belong to

Umask

How to calculate umask values


Umask Values and Permissions




Symbolic Links


Link command

Linux file Security and 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.