feat: add configurable file permissions for new objects

Replace the hardcoded 0644 defaultFilePerm with a NewFilePerm option on
the posix and scoutfs backends, exposed as the --file-perms flag and
VGW_FILE_PERMS env var alongside the existing dir-perms option.

The mode passed to open() is masked by the process umask, so the
O_TMPFILE path now chmods explicitly to match the CreateTemp fallback
path and give new objects the configured mode regardless of umask.
This commit is contained in:
Kyd Cao
2026-08-28 08:51:03 -07:00
committed by Ben McClelland
parent f04bd6a068
commit 45a532e6a6
8 changed files with 191 additions and 76 deletions
+14
View File
@@ -596,6 +596,13 @@ ROOT_SECRET_ACCESS_KEY=
# as any parent directories automatically created with object uploads.
#VGW_DIR_PERMS=0755
# The default permissions mode when creating new object files is 0644. Use
# VGW_FILE_PERMS option to set a different mode for any new file that the
# gateway creates for an uploaded object. Only permission bits (0000-0777) are
# accepted. Unlike VGW_DIR_PERMS, this mode is applied explicitly and is not
# reduced by the process umask.
#VGW_FILE_PERMS=0644
# To enable object versions, the VGW_VERSIONING_DIR option must be set to the
# directory that will be used to store the object versions. The version
# directory must NOT be a subdirectory of the VGW_BACKEND_ARG directory.
@@ -722,6 +729,13 @@ ROOT_SECRET_ACCESS_KEY=
# as any parent directories automatically created with object uploads.
#VGW_DIR_PERMS=0755
# The default permissions mode when creating new object files is 0644. Use
# VGW_FILE_PERMS option to set a different mode for any new file that the
# gateway creates for an uploaded object. Only permission bits (0000-0777) are
# accepted. Unlike VGW_DIR_PERMS, this mode is applied explicitly and is not
# reduced by the process umask.
#VGW_FILE_PERMS=0644
# To enable object versions, the VGW_VERSIONING_DIR option must be set to the
# directory that will be used to store the object versions. The version
# directory must NOT be a subdirectory of the VGW_BACKEND_ARG directory.