File Permission in linux and File Permission in linux

Source: Internet
Author: User

File Permission in linux and File Permission in linux

In linux, we found that the linux system has stricter file permission management than windows.

Create a new group in linux: groupadd group name

New linux User: useradd User Name

Create and group users: useradd-g group name Username

View user information: cat/etc/passwd or vi/etc/passwd. The cat command can only be viewed, but has no modification permission. The vi command has both viewing permission, you have the modification permission (that is, the read/write permission)

For example, create two groups: group A and group B.

Create two users: a and B

User a belongs to group A, and user B belongs to Group B.

When user B wants to access user a's files, user a must be given the corresponding permissions.

Command: chmod 777

Then use: ls-l to display

Drwxrwxr-x is a string of such characters. The first character is a file type, and the last three strings indicate the permissions of the current user, the current user, and other users.

W: writable value: 2

R: readable value: 4

X: executable representation value: 1

777 indicates that all users have the permission to read, write, and execute, because 1 + 2 + 4 = 7, right. It is hard to understand ..

To send user B to Group A, you must use usermod-g A B as the administrator.



In linux, how does one change the permissions of a file (command)

Chmod (user permission) (Group permission) (Other permission) File
Permission: r (read) w (write) x (execution) --- numbers 4, 2, and 1 respectively
To grant "User read/write execution permission; group user read permission; other user read permission", run the following command: chmod 622 file:

In linux, the permission for a file is: d

D Indicates directory. in Linux, a file (folder) Permission includes the host permission, group permission, and other permissions, which are divided into three sections, each segment is represented by rwx. r represents read, w represents write, and x represents execution,
For example, a folder has the read and write permissions on its host, and its group has the read and write permissions. Others only have the read permission.
Indicates drwxrw-r --

Related Article

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.