Directory permissions and file permissions in Linux

Source: Internet
Author: User

The Linux permissions are divided into rwx three types:

R:read the Read permission.

W:write permission to write

Permissions performed by X:execute

1. Permissions for files

There is nothing special about the read and write permissions of the file.

So what is file execution permissions?

Whether the file can be executed under window is determined by the suffix name, for example:. exe. com. bat, etc.

But in Linux the suffix is often just a representation of what type, and, as to whether it can be executed, depends on the file's X permission.

1[[email protected] bin]# 2[[email protected] bin]# 3[[email protected] bin]#chmod o-x ls4[[email protected] bin]#ls-l ls5-RWXR-XR--. 1 root root 109208 November 22 2013ls6[[email protected] bin]#su RT7[Email protected] bin]$ls8BASH:/bin/ls: Insufficient permissions9[Email protected] bin]$lsTenBASH:/bin/ls: Insufficient permissions One[email protected] bin]$ LS-L ABASH:/bin/ls: Insufficient permissions

When the user switches to root:

1 [[email protected] bin]$ ls-l ls2 bash:/bin/ls: Insufficient permissions 3 [[email protected] bin]$ su root4 Password:5 [[email protected] bin]#  ls-l ls6 -RWXR-XR--. 1 root root 109208 November ls

You can see the command on line 5th, the execution succeeds,

You can see whether the file can be executed depending on the X permission of the file.

2. Permissions for the Directory

2.1 x Permissions

Directory execution permissions, that is, whether the user CD into the directory, that is, the directory of execution permissions is actually, whether the directory is enabled, if enabled, you can CD into the directory,

Otherwise, the CD command is an error when executed. Insufficient Authority .

2.2 R Permissions

To see the files and directories in directory A, directory a must be used for R permissions, which means that for the directory, his R Read permission is: You can see the files and directories under the directory

2.3 W Permissions

For the directory, write permissions are: New, delete, modify, move directories within the file and directory permissions.

for a directory, it is important to execute permissions because the read and write permissions for the directory cannot be performed without the Execute permission.

For example: to execute the following command:

CP Hello.txt Test1

Copy the Hell.txt file under the current directory to the Test1 directory, and if the current user does not have execute permissions on the Test1 directory, the command execution is unsuccessful and will

The report does not have permission errors.

Directory permissions and file permissions in Linux

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.