Python OS module os.chmod

Source: Internet
Author: User

Tag: Owner performs file directory permission mask print GID exec Ros process

The Os.chmod () method is used to change the permissions of a file or directory.

Os.  chmod(path, mode)

Parameters
  • Path--The file name path or directory path.

  • Flags --The following options can be generated by bitwise OR operation, the Read permission of the directory is to obtain the list of file names in the directory, the execution permission indicates that the working directory can be switched to this directory, delete the added directory files must have both write and execute permissions, file permissions to the user id-> Group id-> Other sequential checks, the first matching allowed or forbidden permission is applied.

    • Stat. S_ixoth: Other users have executive rights 0o001
    • Stat. S_iwoth: Other users have write permission 0o002
    • Stat. S_iroth: Other users have Read permission 0o004
    • Stat. S_irwxo: Other users have full permissions (permission mask) 0o007
    • Stat. S_IXGRP: group user has execute permission 0o010
    • Stat. S_IWGRP: group user has write permission 0o020
    • Stat. S_IRGRP: group user has Read permission 0o040
    • Stat. S_IRWXG: group user has full permissions (permission mask) 0o070
    • Stat. S_IXUSR: owner has execute permission 0o100
    • Stat. S_IWUSR: owner has write permission 0o200
    • Stat. S_IRUSR: owner has Read permission 0o400
    • Stat. S_irwxu: owner has full permissions (permission mask) 0o700
    • Stat. S_ISVTX: The file directory in the directory only the owner can delete the changes 0o1000
    • Stat. S_isgid: Execute this file its process valid group is the file group 0o2000
    • Stat. S_isuid: Execute this file whose process is valid for the user as the file owner 0o4000
    • Stat. S_iread: windows under Read-only
    • Stat. S_iwrite: Cancel Read-only under Windows
    • Stat. S_iexec:execute by Owner.                                                       Permissions performed on the owning person



Python OS module os.chmod

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.