Linux chmod 755

Source: Internet
Author: User
Tags readable

chmod is a command that sets file permissions under Linux, followed by a number that represents the permissions of different users or groups of users.

It is usually three digits:

The first number indicates the permissions of the file owner

The second number indicates the permissions of other users who belong to the same user group as the file owner

The third number represents the permissions of the other user groups.

Permissions are divided into three types: Read (r=4), write (w=2), execute (x=1). The combination also has a readable executable (rx=5=4+1), a readable writable (rw=6=4+2), and a readable writable executable (rwx=7=4+2+1).

So,chmod 755 Set the user's permissions to:

1. File owner readable writable executable

2. Other user-readable executables that belong to the same user group as the file owner

3. Other user groups can read the executable

The difference between chmod 4755 and chmod 755 is that it starts with one more, and this 4 means that other users have equal permissions to the owner when they execute the file.

For example: The root user has created an Internet authentication program Netlogin, if other users want to use the Internet access to the program, it requires the root user to run chmod 755 netlogin command to enable other users to run Netlogin.

However, Netlogin may need access to some files that only the root user has access to, and other users may not be able to access the Internet because they do not have enough permissions to perform netlogin.

In this case, you can use the chmod 4755 Netlogin Set up other users in the execution Netlogin also have the root user permissions, so that the internet smoothly.

777 is rwxrwxrwx, which means that the logged-on user (which can be viewed with a command ID), his group, and everyone else has the highest privilege.

Directive Name: chmod

Usage rights: All users
Mode of Use: chmod [-CFVR] [--help] [--version] Mode file ...
Description: Linux/unix file access rights are classified into three levels: file owners, groups, and others. The use of chmod can be used to control how files are accessed by others.

Parameter format:

Mode: Permission set string in the following format: [Ugoa ...] [[+-=][RWXX] ...] [,...], where

U: Represents the owner of the file, G means that the owner of the file belongs to the same group (group), O indicates other persons, and a means that all three are.
+: Indicates an increase in permissions,-represents a cancellation permission, = Represents a unique set of permissions.
R: Indicates readable, w means writable, x is executable, x indicates only if the file is a subdirectory or the file has been set to be executable.

-C: If the file permissions have changed, the change action will be displayed
-F: Do not display an error message if the file permissions cannot be changed
-V: Show details of permission changes
-r: The same permissions change for all files in the current directory and subdirectories (that is, they are changed in a recursive manner)
--HELP: Show Auxiliary Instructions
--version: Display version
Example: Set the file file1.txt to be read by everyone:
chmodUgo+r file1.txt
Set the file file1.txt to be readable by everyone:
chmodA+r file1.txt
The file file1.txt and File2.txt are set as the owner of the file, and the same group as the person to which they belong can be written, but others other than the other are not writable:
chmodUg+w,o-w file1.txt File2.txt
Set ex1.py to only the owner of the file can perform:
chmodU+x ex1.py
Set all files and subdirectories in the current directory to be readable by anyone:
chmod-R A+r *
In additionchmodYou can also use numbers to indicate permissions such aschmod 777File
The syntax is:chmodABC File
Each of the a,b,c is a number that represents the permissions of the user, Group, and other respectively.
R=4,w=2,x=1
To rwx the attribute then 4+2+1=7;
To rw-the attribute then 4+2=6;
To r-x the property, 4+1=7.
Example:
chmodA=RWX File andchmod 777File effect is the same
chmodUg=rwx,o=x File andchmod771 file effect is the same
If you usechmod4755 filename causes this program to have root permissions

Linux chmod 755

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.