Linux-File permissions

Source: Internet
Author: User

-rwxr-xr-x 1 root root 42304 Sep 4 18:30 test.log

  1. The first part is the permissions of the file :
    • The first character indicates that the file is "directory, file or link file, etc."
      • D: Catalogue
      • -: File
      • L: Link File
      • B: Device interface available for storage
      • C: Serial port device, such as keyboard, mouse
    • Rwxr-xr-x, three groups representing the permissions of the file owner (U), the same user group (g), and other non-user groups (O):
      • R: Readable, 4
      • W: Writable, 2
      • x: Executable, 1
      • rwxr-xr-x=755
  2. To change file permissions:
    • chmod: Changing the permissions of a file
      • chmod [-CFRV] MODE directory or file
      • -C: report information when a change occurs
      • -F: Error message not output
      • -R: Working with directories and their subdirectories
      • -V: Display processing information
      • Mode can be divided into:
        • chmod 777 File:file's permission is rwxrwxrwx
        • chmod a+x file: All users and Groups plus X permissions
        • chmod u=rw File: Change the permissions of the owner to RW
        • chmod g-x File: Remove the permissions of the user group from the Execute permission
    • chgrp: Changing the user group to which the file belongs
      • CHGRP [-CFRV] [group] File/directory
      • The meaning of each option is the same as above
      • CHGRP users file: Change the user group of file to users
      • Chgrp--reference=file1 file2: Make the File2 user group the same as File1
    • chown: Changing the file owner
      • chown [-cfrv][owner][:[User Group]] File/directory
      • Chown mail:mail File
      • Chown:mail file
      • Chown--reference=< files or directories > files or directories

Linux-File 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.