chmod 777 Setting Directory Permissions

Source: Internet
Author: User



Http://william71.blogbus.com/logs/33484772.html



755 on behalf of the user to the file has read, write, chmod directory execute permissions, the same group of other people have the ability to execute and read, chmod 777 directory no write permission, the other user's permissions and the same group of people permissions.

777 stands for, User,group, others, both read and write and execute permissions.



Under various UNIX and Linux operating systems, each file (folder is also considered a file) is read, chmod all files in directory write, run set permissions.
For example, when I use the ls-l command to list file tables, I get the following output:
-rw-r--r--1 apple users 2254 2006-05-20 13:47 tt.htm
From the second word character rw-is that the user Apple has read, write right, no operation right, and then the r--that the user group users only Read permission, no operation, the last r--refers to other people (others) only read permission, no write rights and operation rights. This is the system default settings, I can rewrite tt.htm, the same group of people and others only have the right to read, no one has the right to run, because just an HTML file, do not have to run. This was advanced prior to Novell's directory services.
Read, write, run three permissions can be expressed in numbers, that is, r=4,w=2,x=1. So, the rw-r--r--in the above example is represented by a number of 644.
On the other hand, 777 is rwxrwxrwx, which means that the logged-on user (which can be viewed with a command ID), his group, and others have the highest privileges.
Say one more word. I use the chmod o-r tt.htm command to change the permissions, chmod directory permissions O-r is others the permission to lose read. The result is
-rw-r-----1 BU users 2254 2006-05-20 13:47 tt.htm
If you use the command chmod 777 tt.htm, the result is
-rwxrwxrwx 1 bu users 2254 2006-05-20 13:47 tt.htm
Anyone has three permissions to read, write, and run.


---------------------------------------------
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, chmod files in directory groups,chmod recursive directory  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:
chmod ugo+r File1.txt

Set the file file1.txt to be readable by everyone:
chmod a+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, chmod cannot access gradlew no such file or directory but others other than the other are not writable:
chmod ug+w,o-w file1.txt File2.txt

Set ex1.py to only the owner of the file can perform:
chmod u+x ex1.py

Set all files and subdirectories in the current directory to be readable by anyone:
Chmod-r A+r *

In addition chmod can also use numbers to represent permissions such as chmod 777 file

The syntax is: chmod ABC 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:
chmod a=rwx file and chmod 777 file effect are the same

chmod ug=rwx,o=x file and chmod 771 file effect are the same

Use chmod 4755 filename to give the program root privileges


chmod 777 Setting Directory 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.