summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2023-03-30 14:41:47 +0300
committerPanu Matilainen <pmatilai@redhat.com>2023-03-30 14:41:47 +0300
commite38b8d937673e979fa646cbd2010e91e57636d00 (patch)
tree78c74318ac353aad78135c097e878a6b76999fa4
parent13e89c6ae5ff9cb20b0721e80732e7cde55da96c (diff)
downloadrpm-e38b8d937673e979fa646cbd2010e91e57636d00.tar.gz
Briefly document %attr() and %defattr() in the manual
-rw-r--r--docs/manual/spec.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/manual/spec.md b/docs/manual/spec.md
index 8e659d2b4..534d06f7b 100644
--- a/docs/manual/spec.md
+++ b/docs/manual/spec.md
@@ -630,6 +630,31 @@ More information is available in [file trigger chapter](file_triggers.md).
## %files section
+### Permissions and ownership
+
+By default, packaged files are owned by root:root and permission bits
+are taken directly from the on-disk files. Refer to
+[users and groups](users_and_groups.md) for dealing with other users
+and groups.
+
+There are two directives to override the default:
+
+#### `%attr(<mode>, <user>, <group>) <file|directory>`
+
+`%attr()` overrides the permissions for a single file. `<mode>` is
+an octal number such as you'd pass to `chmod`(1), `<user>` and `<group>`
+are user and group names. Any of the three can be specified as `-` to
+indicate use of current default value for that parameter.
+
+#### `%defattr(<mode>, <user>, <group>, <dirmode>)`
+
+`%defattr()` sets the default permissions of the following entries in
+up to the next `%defattr()` directive or the end of the `%files` section
+for that package, whichever comes first.
+
+The first three arguments are the same as for `%attr()` (see above),
+`<dirmode>` is the octal default mode for directories.
+
### Virtual File Attribute(s)
#### %artifact (since rpm >= 4.14.1)