Linux file directories and permissions

Source: Internet
Author: User

Linux file directories and permissions

Objective:

Linux generally divides the file-accessible identity into three categories, namely Owner/group/others, according to the permissions, each directory can have a relative identity-rwx[readable writable executable]

Users and Groups:

Owner: The file owner, such as Jane, who owns the file, can manipulate the file appropriately.

Group: A file has a group, such as a project group, with three people people1,people2, People3, and the file is owned by the project group, the three members within the group can manipulate the file appropriately.

Other: The other owner, that is, the executable operation of removing owner and group

Linux file properties

Use Ls-al to view the files in the current directory (-a shows hidden files, beginning with.)

Divided by Space: [Permissions] [link] [owner] [Group] [File size] [date modified] [filename]

1) [permissions]: consists of 10-bit characters representing the type and permissions of this file

The first character indicates that the file is a directory, a file, or a linked file, etc.

Directory

l When [d] is the directory, for example, the previous table file name is ". config" of the line;

l When [-] is the file, for example, the above table file is called "Esd_auth" the line;

L if [l] is a link file;

l if [b] is a device file inside the storage of the peripheral equipment (can be random access equipment);

l if [C] is indicated as a serial port device in the device file, such as a keyboard, mouse (one-time read device).

In the following characters, a group of three, each of which is a combination of three parameters, is "rwx".

l [R] stands for readable (read)

l [W] stands for writable (write)

l [x] stands for executable (execute).

The position of these three permissions will not change, if there is no permission, there will be a minus sign [-]

• Type and data can be separated when viewed: [-][rwx][r-x][r--]è1 234 567 890

1: Represents this file name as directory or file

234: Owner's permission

567: Same group User rights

2) [link]: Indicates how many file names are linked to this node (I-node)

Each file will log his permissions and attributes to the file system's I-node, and the directory tree we use is recorded using a file name, so each file name is linked to a i-node, and this property records how many different filenames are linked to the same i-node number.

3) [owner]: Represents the "Owner account" of this file (or directory)

4) [Group]: Indicates the group to which this file belongs

5) [File size]: The size of the file, the default unit is bytes

6) [Date Modified]: the date the file was created or the most recent modification date

7) [filename]: filename of file

Changing file properties and Permissions

1) chgrp: Changing the group of files (change group): The changed group name must be

exists within the/etc/group file, otherwise an error will be displayed.

2) Chown: Changing the file owner (change owner): The user must be an existing account in the system, that is, a record user name in the/etc/passwd file to change

Chown [-r] Account name file or directory

Chown [-r] Account name: Group name file or directory (with group to which the change file belongs)

-R: Continuous change of recursion (recursive), along with all files in the secondary directory

3) chmod: Change the file permissions, SUID, SGID, Sbit, and so on features

You can change permissions by using numbers or symbols, respectively.

Privilege Score Control: R:4 w:2 x:1

a) chmod [-r] XYZ file or directory

XYZ: The permission property of a numeric type, which is the sum of the numeric values of the Rwx property.

b) chmod | U g o A | + (Join)-(remove) = (set) | R W x | File or directory

User, group, others three kinds of identities, borrowed by U, G, O to generation. In addition, a represents all the identities

Linux file types and extensions

L Plain Text file (ASCII): Data that can be read directly, cat instructions can view the file

Binary file binary: An executable file for a general computer system

L Data Format file: A file in a specific format can be called a data file, last to view the file, and the use of cat will appear garbled

L Catalog (directory)

L linked file (link)

L Equipment and equipment files: Some files related to the perimeter and storage of the system, usually in the/dev directory

2 Block device files: Some storage data to provide system random access peripherals, such as hard disks and floppy disks [b]

2-character (character) device files: Peripheral devices for some serial ports, such as keyboards, mice, etc. [C]

L Data Interface file (sockets): Usually used for data transmission on the network

L Data Transfer file (FIFO, pipe): FIFO is also a special type of file, which solves the error problem caused by multiple programs accessing a file simultaneously.

Linux file extension

L. SH: script or batch file (scripts)

L Z, . Tar, . tar,.gz, . zip, *.tgz: Packaged compressed files, with different compression methods and different suffixes

L . html, . PHP: web-related files

Linux directory configuration based on-FHS (Filesystem Hierarchy Standard)

L FHS main functions: specification of what data should be placed in each specific directory

L FHS Four kinds of interactive forms under the catalogue

1) Shareable: A directory that can be shared with other system mounts

2) Non-shareable: some privacy data

3) Unchanging: Data that does not change frequently

4) Variable: constantly changing data

L FHS three-tier directory defined for the directory tree schema

1) Definition of three directories:

2)/(root, root directory): Related to the boot system;

3)/usr (Unix software Resource): Related to Software installation/execution;

4)/var (variable): related to the system operation process.

/etc----configuration file

/bin----Important Execution files

/dev----required device files

/lib----function Libraries required to execute the file and the modules needed by the kernel

/sbin----Important System execution files

Linux file directories 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.