{
    "mode": "info",
    "parameter": "chmod",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/chmod/json",
    "generated": "2026-07-30T21:44:34Z",
    "sections": {
        "File: coreutils.info,  Node: chmod invocation,  Next: touch invocation,  Prev: chgrp invocation,  Up: Changing file attributes": {
            "content": "",
            "subsections": [
                {
                    "name": "13.3 'chmod': Change access permissions",
                    "content": "'chmod' changes the access permissions of the named files.  Synopsis:\n\nchmod [OPTION]... {MODE | --reference=REFFILE} FILE...\n\n'chmod' never changes the permissions of symbolic links, since the\n'chmod' system call cannot change their permissions.  This is not a\nproblem since the permissions of symbolic links are never used."
                }
            ]
        },
        "However, for each symbolic link listed on the command line, 'chmod'": {
            "content": "changes the permissions of the pointed-to file.  In contrast, 'chmod'\nignores symbolic links encountered during recursive directory\ntraversals.\n\nOnly a process whose effective user ID matches the user ID of the\nfile, or a process with appropriate privileges, is permitted to change\nthe file mode bits of a file.\n\nA successful use of 'chmod' clears the set-group-ID bit of a regular\nfile if the file's group ID does not match the user's effective group ID\nor one of the user's supplementary group IDs, unless the user has\nappropriate privileges.  Additional restrictions may cause the\nset-user-ID and set-group-ID bits of MODE or REFFILE to be ignored.",
            "subsections": []
        },
        "This behavior depends on the policy and functionality of the underlying": {
            "content": "'chmod' system call.  When in doubt, check the underlying system\nbehavior.\n\nIf used, MODE specifies the new file mode bits.  For details, see the\nsection on *note File permissions::.  If you really want MODE to have a\nleading '-', you should use '--' first, e.g., 'chmod -- -w file'.",
            "subsections": []
        },
        "Typically, though, 'chmod a-w file' is preferable, and 'chmod -w file'": {
            "content": "(without the '--') complains if it behaves differently from what 'chmod\na-w file' would do.\n\nThe program accepts the following options.  Also see *note Common\noptions::.\n\n'-c'\n'--changes'\nVerbosely describe the action for each FILE whose permissions\nactually changes.\n\n'-f'\n'--silent'\n'--quiet'\nDo not print error messages about files whose permissions cannot be\nchanged.\n\n'--preserve-root'\nFail upon any attempt to recursively change the root directory,\n'/'.  Without '--recursive', this option has no effect.  *Note\nTreating / specially::.\n\n'--no-preserve-root'\nCancel the effect of any preceding '--preserve-root' option.  *Note\nTreating / specially::.\n\n'-v'\n'--verbose'\nVerbosely describe the action or non-action taken for every FILE.\n\n'--reference=REFFILE'\nChange the mode of each FILE to be the same as that of REFFILE.\n*Note File permissions::.  If REFFILE is a symbolic link, do not\nuse the mode of the symbolic link, but rather that of the file it\nrefers to.\n\n'-R'\n'--recursive'\nRecursively change permissions of directories and their contents.\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n\nExamples:\n\n# Change file permissions of FOO to be world readable\n# and user writable, with no other permissions.\nchmod 644 foo\nchmod a=r,u+w foo\n\n# Add user and group execute permissions to FOO.\nchmod +110 file\nchmod ug+x file\n\n# Set file permissions of DIR and subsidiary files to\n# be the umask default, assuming execute permissions for\n# directories and for files already executable.\nchmod -R a=,+rwX dir\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}