File permissions under Linux

Source: Internet
Author: User
Tags readable

File Management Way

Linux management methods are managed by the file, is the old saying that everything is the idea of files, files are files, directories and peripherals are special files


To view all the file commands in a directory:

Each column has the following meanings:

    • First column: File type.
    • Second column: Indicates the number of files. If it is a file, then it is 1; if it is a directory, it is the number of files in that directory.
    • The third column: The owner of the file, the creator of the file.
    • Fourth column: The user group where the file owner resides. In Linux, each user is affiliated to a user group.
    • Fifth Column: File size (in bytes).
    • Column Sixth: The time when the file was created or was last modified.
    • Seventh column: File name or directory name.

Note: Each directory has a subdirectory "." and a sub-directory pointing to its parent directory ".", so for an empty directory, the second column should be 2.

by Ls-l The files listed, each line begins with a, d,-or L, which represent the file type:

prefix Description
- Normal file. such as text files, binary executables, source code, and so on.
B Block device files. The hard disk can use block device files.
C Character device files. The hard disk can also use character device files.
D Catalog files. Directories can contain files and other directories.
L Symbolic links (soft links). You can link any normal file, similar to a shortcut in Windows.
P Named pipes. Pipelines are a communication mechanism between processes.
S A socket for interprocess communication.

Hint: The popular talk soft connection is the Windows shortcut, the original file is deleted, although the shortcut is not working.



The first column contains the permissions for the file or directory.

The characters in the first column can be divided into three groups, each of which has three, and each character nonalphanumeric represents a different permission, read (R), write (w), and execute (x), respectively:

    • The first set of characters (2-4) represents the permissions of the owner of the file, and-rwxr-xr--indicates that the owner has read (R), write (w), and execute (x) permissions.
    • The second set of characters (5-7) represents the permissions of the user group to which the file belongs, and-rwxr-xr--indicates that the group has read (R) and execute (x) permissions, but no write permission.
    • The third set of characters (8-10) represents the permissions of all other users, and rwxr-xr--indicates that other users can only read (r) files.
File access Mode file permissions are the first security line of the Linux system, with basic permissions to read (R), write (w), and execute (x):
    • READ: The user can read the file information and view the contents of the file.
    • Write: The user can edit the file, write to the file, or delete the contents of the file.
    • Execute: The user can run the file as a program.
The Directory Access mode directory has a similar access pattern to files, but slightly different:
    • READ: Users can view files in a directory
    • Write: Users can delete files or create files in the current directory
    • Execute: Execute permissions give the user the right to traverse the directory, such as the Execute CD and the LS command.
Changing permissions can be used chmod(change mode) command to alter the access rights of a file or directory, which can be represented by symbols or numbers.


Here's a separate chmod 777 and chmod 755 in the meaning of 777 and 755 permissions

Permissions in the file:

R==> readable w==> writable x==> executable
R=4 w=2 X=1
So 755 stands for rwxr-xr-x.

777 for RWXR-RWX-RWX All users are readable writable executable.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

File permissions under 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.