chmod.1 (2107B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2024-03-12
- .Dt CHMOD 1
- .Os
- .Sh NAME
- .Nm chmod
- .Nd Change files modes
- .Sh SYNOPSIS
- .Nm
- .Op Fl cRv
- .Ar mode
- .Ar file...
- .Sh DESCRIPTION
- .Nm
- sets the permissions bits given by
- .Ar mode
- on each given
- .Ar file .
- .Pp
- .Ar mode
- can be either an octal natural number between 0 and 7777 (ie. 0644 for rw-r--r--), or a symbolic operation, like
- .Ql +r or
- .Ql g=o-x ,
- see
- .Sx SYMBOLIC OPERATIONS
- section for more information.
- .Pp
- If
- .Ar mode
- starts with a dash (or is user-provided), it should be broken from options with a preceeding double-dash
- .Pq --
- like so:
- .Dl chmod -v -- -w,+r foobar
- .Sh OPTIONS
- .Bl -tag -width Ds
- .It Fl c
- Print mode changes
- .It Fl R
- Recurse into directories passed to
- .It Fl v
- Verbose, print both changes and retained modes
- .Ar file
- .El
- .Sh SYMBOLIC OPERATIONS
- Roughly corresponds to the following regex:
- .Ql ((^|,)[ugoa]*([+-=][ugo]|[+-=][rwxXst]+)+)+
- .Bl -tag -width Ds
- .It ,
- Separator between each operation,
- .Ql g+r,o=g
- sets read for group and copies to other the resulting permissions of group.
- .It [ugoa]
- who: Sets who to assign permissions to.
- .It [+-=]
- op: Respectively add(+), del(-), set(=).
- .Pp
- When who isn't given,
- .Xr umask 3
- is followed similarly to file creation.
- When neither permcopy nor permlist is given, set(=) clears all permissions.
- .It [ugo]
- permcopy: Sets who to copy permissions from.
- .It [rwxXst]+
- permlist: Sets which permissions to assign, respectively:
- .Bl -tag -width X
- .It r
- Read
- .It w
- Write
- .It x
- Execute/Search
- .It X
- Search (directories-only)
- .It s
- Setuid when assigned to user, setgid when assigned to group.
- .It t
- Sticky bit.
- .El
- .El
- .Sh EXIT STATUS
- .Ex -std
- .Sh SEE ALSO
- .Xr stat 1
- .Sh STANDARDS
- .Nm
- should be compliant with the
- IEEE Std 1003.1-2024 (“POSIX.1”)
- specification.
- .Pp
- The
- .Fl c
- and
- .Fl v
- options are present for compatibility with other modern systems such as BusyBox and GNU coreutils.
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me