LINUX File Permissions Detailed

Source: Internet
Author: User
Tags file permissions

Ls-l//View file permissions equivalent to LL


Permission information for a file view

-rw-rw-r--1 Ceshi Ceshi 891 8 17:28 Server

Drwxrwxr-x Ceshi Ceshi 4096 17:51 www.aa.com

Start 10 characters determine the permissions for different users to manipulate files

The first character represents a file (-), a directory (d), a connection (L)

The remaining characters are set per three (RWX), read (R), write (W), execute (x)

First set of rwx: The permissions of the file owner are read, write, and execute

Second set of rw-: Permissions for users of the same group as the file owner are read, write, but cannot be executed

Third group r--: permissions for other users who are not in the same group as the file owner are read and cannot be written and executed

It can also be a numeric representation of r=4,w=2,x=1

Rwx:=>7 read, Write and execute
Rw-:=>6 Read and write. Cannot execute
R--:=>4 read-only files
R-x:=>5 Read and Execute
-w-:=>2 Write
-wx:=>3 Write, execute
--x:=>1 execution

1 indicates the number of files connected
Ceshi indicates that the user
Ceshi represents the group to which the user resides
891 indicates the size of the file (bytes)
8 17:28 Indicates the date the file was last modified
Server represents the file name


Commands to modify Permissions

chmod changing the permissions of a file or directory

chmod 755 Server gives permissions to the server Rwxr-xr-x

chmod u=rwx,g=rx,o=rx Serveru User Rights g user group permissions o different groups of other user rights

chmod u-x,g+w Server removes user-executed permissions and increases user group Write permissions

chmod a+r Server to add Read permissions to all users


Change owner (chown) and user Group (CHGRP) commands

Chown xiaoming ABC: Change the owner of ABC to Xiaoming

CHGRP Root ABC: Change the group that the ABC belongs to IS root

Chown root./ABC: Change ABC the owner of this directory is root

Chown‐r root./ABC: Change the ABC directory and the owner of all files and directories below it is root

Change the user group

When you add a user, you can specify which group to add the user to, as well as root administrative permissions to change the group in which a user resides

-USERMOD‐G Group name User name

You can use

-Usermod‐d directory name User name, change the initial directory of the user login

-Groupadd group name, adding groups to Linux

-Vi/etc/group, see all the group information in Linux, can be edited

-Cat/etc/group, view all the group information in Linux, can not be edited

-USERADD‐G group name User name, create a user and specify which group to assign the user to

-VI/ETC/PASSWD, see all user information in Linux, can be edited

-CAT/ETC/PASSWD, view all the user information in Linux, can only see can not edit

LINUX File Permissions Detailed

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.