Permissions explained in Linux

Source: Internet
Author: User

1, each file belongs to a user, a group
Can be queried by the $ ls-l/bin/bash command
$ ls-l/bin/bash
-rwxr-xr-x 1 root root 736348 2014-09-26/bin/bash

2. The Linux permissions model works by allowing three separate permission levels to be set for each file system object-they are the owner of the file, the group of files, and all other users.
-rwxr-xr-x 1 root root 736348 2014-09-26/bin/bash
As above rwxr is the owner-oriented XR is for the group system in the other user all rights X

3.-rwxr-xr-x a symbolic representation of the permission that contains the special file. The first character in the field (-) specifies the type of the file, in which case it is a regular file. Other possible first characters are:
"D" Directory
"L" symbolic link
"C" character specialized device file
"B" block specialized equipment files
"P" Advanced first Out
"S" sockets
eg
-rw-r--r--1 root root 0 04-15 14:26:1,.d
Drwxr-xr-x 4 Hadoop hadoop 4096 04-24 14:14 Desktop
DRWX------7 Hadoop hadoop 4096 04-13 23:30 Downloads
Drwxrwxr-x 5 Hadoop hadoop 4096 04-01 15:13 Flume
Drwxr-xr-x Hadoop hadoop 4096 03-31 19:30 Hadoop
Drwxrwxr-x 9 Hadoop hadoop 4096 04-13 12:57 Hive
Drwxr-xr-x 5 Hadoop hadoop 4096 04-12 15:35 java
Drwxrwxr-x 5 Hadoop hadoop 4096 04-13 23:38 Navicat110_mysql_cs
-rw-rw-r--1 Hadoop hadoop 52692169 04-13 20:24 navicat110_mysql_cs.tar.gz
-rw-r--r--1 Hadoop hadoop 04-15 13:31 Oracle account. txt
DRWXRWXRWX 9 Hadoop hadoop 4096 04-01 17:12 Splunk
Drwxr-xr-x Hadoop hadoop 4096 03-20 10:25 Tomcat
Drwxrwxr-x 5 Hadoop hadoop 4096 04-21 23:31 workspace

4. WhoAmI can view the currently logged in user
# WhoAmI
Root
# su Drobbins
$ whoami
Drobbins

5, group can see in which groups
Groups
Hadoop

If you want to see who else is in this group
Groups Hadoop
Hadoop:hadoop
Groups Root
Root:root bin Daemon Sys ADM disk wheel

6. All users or groups that change files or other file system objects must be super users
Grammar:
Chown root/u Change the owner of of/u to "root".
Chown root:staff/u Likewise, but also change it group to the "staff".
Chown-hr root/u Change the owner of of/u and subfiles to "root".

Chown root:wheel/etc/passwd

7. The chmod command is used to change the access rights of a file or directory.

Command Setup method
chmod [who] [+ |-| =] [mode] file name?
Action object who is either or their combination of the following letters:
U means "user", which is the owner of the file or directory.

G means "same group user", that is, all users with the same group ID as the file owner.

O means "other (others) users".

A means "all users". He is the system default value.

+ Add a permission.

-Cancels a permission.
= gives the given permission and cancels all other permissions, if any.
Setting the permissions represented by mode can be any combination of the following letters:
R is readable.

W writable.

X executable.

Digital Setting Method:
chmod [Number of Owner permissions] [number of user rights in group] [number of other user rights in system] file name?
Digital permission Meaning:
RWX 7
Rw-6
R-x 5
r--4
-WX 3
-w-2
--x 1
---0

















































Permissions explained 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.