Files/Directories in Linux general permissions

Source: Internet
Author: User


Permissions

  1. view ############# for file properties

    Ls-l Filename/ls-ld Dictionary
    -|rw-r--r--. | 1| Root|   Root| 46 | OCT 1 05:03 |filename
    — ————————— — ———— ———— —— ———————————— ————————
    1 2 3 4 5 6 7 8
    1. "-": File type
    -# #普通文件
    D # #目录
    C # #字符设备
    S # #套接字
    P # #管道
    B # #快设备
    L # #连接
    2. "rw-r--r--": File read and Write permissions ##########
    rw-|r--|r--
    *   $   @

    * Everyone's rights
    $ permissions for all groups
    @ Other People's permissions

    3. "1":
    File: The number of times the contents of the file have been recorded by the system, in the case of a soft link, here is 2 in other words, the number of times it needs to be deleted.
    To directory: The number of bytes of the file attribute in the directory
    4. "Root": File owner

    5. "Root": all groups of files

    6. "46": Size of File contents

    7. "Oct 1 05:03": The last time the file was modified
    8. "FileName": File name

2. File General Permissions # # #
U: File user can read and write to file
G: File group members are readable for files
O: Other people can read the file
U first match, G priority, O match when U,g mismatch

1.R/4 4 for R permissions
To file: You can view the characters in the file cat
To directory: You can view the directory of the information directory of files, etc.

2.w/2
To file: You can change the characters in the file
For directories: You can add delete files to the directory

3.x/1
To files: program actions that can run records within a file
To the directory: You can enter the directory
3. Modify the file permissions by character # # #
chmod ugo+/-rwx File | directory (-r) "Recursion"
chmod 777 File | directory (-r) "Recursion"

4. System default Permissions set # # # #
#从系统存在角度来说, the greater the open power, the higher the system's existence meaning
#从系统安全角度来说, the less open power, the higher the system security
#所以系统设定新建文件或目录会去掉一些权限
Umask #系统预留权限 Default 0022
Create a new directory permission: 777-umask
Create a new file permission: 777-umask-111 (kernel decision)
Setting mode
Umask # #查看系统保留权限默认为022
Umask 077 # #修改该系统保留权限为077, this setting is temporary and only valid in the current shell

Permanent setting Mode:
VIM/ETC/BASHRC # #shell
If [$UID-gt 199] && ["' id-gn '" = "' Id-un '"]; Then
Umask 002 # #普通用户umask
Else
Umask 022 # #超级用户umask
The fi

Vim/etc/profile # #系统
If [$UID-gt 199] && ["' id-gn '" = "' Id-un '"]; Then
Umask 002 # #普通用户umask
All else
Umask 022 # #超级用户umask
+ fi

Two files above Umask set values must be consistent
Source/etc/bashrc
Source/etc/profile #重新加载文件
Make the setting effective immediately



This article is from the "12462896" blog, please be sure to keep this source http://12472896.blog.51cto.com/12462896/1949999

Files/Directories in Linux general 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.