CHMOD(1)

πŸ“¦ version 1.053, in alpine 3.24

πŸ’… CHMOD(1) β€” like, the Perl one, bestie ✨

Hey so this is chmod(1) from the User Contributed Perl Documentation fam β€” not the GNU one, not the OpenBSD one, this specific Perl implementation, okay? iykyk 🫢


🌸 NAME 🌸

chmod β€” change permissions of files. that's it, that's the vibe. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

chmod [-R [-H | -L | -P]] mode file...

literally just options, then a mode, then the files. slay.


πŸ‘‘ DESCRIPTION πŸ‘‘

okay so chmod sets the permissions of files. and like, the first argument after the options? that's the permission the files should be given. main character argument energy fr. ✨

πŸ’… OPTIONS πŸ’…

chmod accepts the options described below, bestie. the -L, -H and -P options are mutually exclusive, and only the last one you give will be honoured β€” so pick a lane. πŸ’€ and all of -L, -H and -P require the -R option to be set first. no -R, no deal.

  • -R β€” recurse into directories. any directories are recursively traversed, and all files and directories will change owner. go off, get recursive. πŸ”₯
  • -L β€” follow symbolic links. by default, chmod will not follow symbolic links. > bestie this is a potentially dangerous option, because chmod will not check for cycles. be careful. 😭 this option requires the -R option to be set.
  • -H β€” follow symbolic links of command line files/directories only. this option requires the -R option to be set.
  • -P β€” do not follow symbolic links at all. this option requires the -R option to be set.

πŸŽ€ MODES πŸŽ€

so modes are either absolute or symbolic, and honestly both have their moment.

an absolute mode is an octal number, calculated by OR-ing the following values together β€” ngl this is the part you screenshot:

  • 4000 β€” suid on execution.
  • 2000 β€” guid on execution.
  • 1000 β€” the sticky(8) bit is turned on.
  • 0400 β€” read permission for the owner of the file.
  • 0200 β€” write permission for the owner of the file.
  • 0100 β€” execute permission for the owner of the file.
  • 0040 β€” read permission for those in the group as the group of the file.
  • 0020 β€” write permission for those in the group as the group of the file.
  • 0010 β€” execute permission for those in the group as the group of the file.
  • 0004 β€” read permission for all others.
  • 0002 β€” write permission for all others.
  • 0001 β€” execute permission for all others.

symbolic mode is a comma separated list of actions, and each action has this exact format:

[who] operator [permissions] [operator [permissions] ...]

🧚 who 🧚

who consists of zero or more of the following symbols:

  • u β€” permissions for the user (owner) of the file.
  • g β€” permissions for the group of the file.
  • o β€” permissions for all others.
  • a β€” permissions for everyone.

if who is omitted, it will default to a, but the value of your umask is taken into account. chmod will then not set a permission that is masked by your umask. respect the umask, it's giving boundaries. πŸ™ˆ

⭐ the operator ⭐

the operator is one of:

  • + β€” add permissions. if no permissions are given, this action is ignored. if who is absent, set the permission bit as indicated by permissions, but respect the umask settings. if who is given, set the permission bits as indicated by permissions, for those groups indicated by who.
  • - β€” revoke permissions. if no permissions are given, this action is ignored. if who is absent, revoke the permission bit as indicated by permissions, but respect the umask settings. if who is given, revoke the permission bits as indicated by permissions, for those groups indicated by who.
  • = β€” set permissions. the permission bits indicated by who are all cleared. if who isn't given, all permission bits are cleared. then, if who isn't given, those permission bits in permission whose corresponding bit in the umask is clear are set. otherwise, the permission bits are set as indicated by who and permission.

🌈 permission 🌈

permission consists of zero or more of:

  • r β€” the read permission bit.
  • w β€” the write permission bit.
  • x β€” the execute permission bit.
  • X β€” the execute permission bit, but only if the target is either a directory, or has at least one execution bit set in the unmodified permission bits. furthermore, this permission is ignored if operator is either - or =.
  • s β€” the suid and guid bit. these will have no effect in combination with the o who setting.
  • t β€” the sticky bit. this makes sense only for the others group, however, it will be ignored if o is the only group in the who part of the clause.
  • u β€” the original permissions of the user.
  • g β€” the original permissions of the group.
  • o β€” the original permissions for others.

🌼 ENVIRONMENT 🌼

the working of chmod is not influenced by any environment variables. nothing. zero. the environment could never. πŸ’€


πŸ’€ BUGS πŸ’€

okay bestie, buckle up, this section ate:

it is unlikely there are no bugs. the documentation is at best ambiguous. the OpenBSD documentation does not match the OpenBSD implementation. furthermore, the implementations of Solaris, SunOS, HP, and GNU all differ from each other, and from OpenBSD. chaos fr fr. 😭

this manual page needs work. the module PerlPowerTools::SymbolicMode needs to be documented.

chmod parses a symbolic mode once for each file. that is too much redundant work.

🚨 chmod can loop forever when symbolic links create cycles. not a vibe.

chmod uses File::Find to recurse.

this manual should have been written in Texinfo, LaTeX, or a funky SGML application. pod2man, pod2html, pod2text and pod2latex are all broken beyond belief. πŸ’€


πŸ“ STANDARDS πŸ“

it does not make sense to talk about standards in a chmod manual page. periodt. πŸ‘‘


πŸ’œ REVISION HISTORY πŸ’œ

look at this lore, it's literally archaeology:

$Log: chmod,v $
Revision 1.2  2004/08/05 14:17:43  cwest
cleanup, new version number on website

Revision 1.1  2004/07/23 20:10:01  cwest
initial import

Revision 1.3  1999/03/09 02:44:57  abigail
Fixed SybolicMode -> SymbolicMode typo.

Revision 1.2  1999/03/08 03:07:28  abigail
Major documentation tweaks.

Revision 1.1  1999/03/07 12:03:54  abigail
Initial revision

πŸŽ€ AUTHOR πŸŽ€

the Perl implementation of chmod was written by Abigail, perlpowertools@abigail.be. iconic behavior honestly. 🫢


this program is copyright by Abigail 1999.

this program is free and open software. you may use, copy, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same. share the love, bestie. πŸ’–


and that's the whole page!! documented by the Perl crew, version perl v5.42.2, dated 2026-02-15 β€” so yeah, go chmod responsibly, and remember: with great -R comes great responsibility. bye bestie!! πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from