AWS Security ChangesHomeSearch

AWS AmazonS3: Added guidance for setting POSIX metadata on directories

Service: AmazonS3 · 2026-10-03 · Documentation medium

File: AmazonS3/latest/userguide/s3-files-posix-permissions.md · Type: authz

Summary

New section explains that a directory's owner/group/mode come solely from the zero-byte directory marker object, that markers lacking POSIX metadata default to root:root with 0755 (read/traverse for all, write only for root), and shows copy-object/put-object commands to set file-owner, file-group, and directory file-permissions bits.

Security assessment

This is permission-model documentation: it describes default directory ownership/ACLs and how to apply explicit POSIX metadata, which directly governs NFS client authorization and the risk of overly broad (0755/root-owned) directory access. It documents a security-relevant behavior and hardening step but does not fix a specific vulnerability.

Evidence

+In that case, S3 Files assigns the directory the default `root:root` ownership with `0755` permissions. With these permissions, all users can read and traverse the directory, but only the owner (root) can create or delete files within it.

Diff

diff --git a/AmazonS3/latest/userguide/s3-files-posix-permissions.md b/AmazonS3/latest/userguide/s3-files-posix-permissions.md
index aaad40a..b8bcb1d 100644
--- a//AmazonS3/latest/userguide/s3-files-posix-permissions.md
+++ b//AmazonS3/latest/userguide/s3-files-posix-permissions.md
@@ -7 +7 @@
-POSIX permissions and direct S3 accessHow S3 Files stores POSIX metadataSetting POSIX metadata on existing objectsSetting POSIX metadata on new uploadsPermission values referenceBest practices
+POSIX permissions and direct S3 accessHow S3 Files stores POSIX metadataSetting POSIX metadata on existing objectsSetting POSIX metadata on a directorySetting POSIX metadata on new uploadsPermission values referenceBest practices
@@ -97,0 +98,28 @@ The file is now owned by `ec2-user` and no longer requires root to access.
+## Setting POSIX metadata on a directory
+
+A directory's ownership and permissions come from a single object: the zero-byte directory marker at the prefix key with a trailing slash, for example `data/`. S3 Files reads POSIX metadata from that one marker object to determine the directory's owner, group, and permissions. The objects inside the directory do not affect it. Each child object carries its own metadata and governs only itself.
+
+When a directory's objects were written to your bucket before the file system existed, the directory marker has no POSIX metadata. This also applies when the objects were written through the Amazon S3 console, AWS CLI, or AWS SDK. In that case, S3 Files assigns the directory the default `root:root` ownership with `0755` permissions. With these permissions, all users can read and traverse the directory, but only the owner (root) can create or delete files within it. As a result, a non-root user receives a permission error when writing to the directory.
+
+For directories, set the `file-permissions` value with directory bits, for example `0040755`. For more values, see Permission values reference.
+
+To update the directory's metadata in place, copy the directory marker object onto itself with new metadata. This keeps any content stored in the object.
+    
+    
+    aws s3api copy-object \
+        --bucket BUCKET_NAME \
+        --key data/ \
+        --copy-source BUCKET_NAME/data/ \
+        --metadata-directive REPLACE \
+        --metadata '{"file-owner":"1001", "file-group":"1001", "file-permissions":"0040755"}'
+
+If the command returns a 404 error, the directory marker object doesn't exist. The directory is implied only by its child keys, so it uses the `root:root` default. Create the marker object with the metadata.
+    
+    
+    aws s3api put-object \
+        --bucket BUCKET_NAME \
+        --key data/ \
+        --metadata '{"file-owner":"1001", "file-group":"1001", "file-permissions":"0040755"}'
+
+Setting metadata on the directory marker changes only the directory itself. To change a child file's ownership, set metadata on that file object. For instructions, see Setting POSIX metadata on existing objects.
+