Make changes to correct perms on /data

This commit is contained in:
M. Rehan
2024-05-08 00:41:39 +05:00
parent 2d70f78b4d
commit 9941716bb1
2 changed files with 6 additions and 2 deletions

View File

@@ -477,9 +477,13 @@ def main():
setup_machine_id = configure_serial = True
# We do not want /data directory to be world readable
# We only want /data itself (without contents) and /data/subsystems to be 755
# whereas everything else should be 700
# Doing this here is important so that we cover both fresh install and upgrade case
run_command(["chmod", "-R", "u=rwX,g=,o=", f"{root}/data"])
run_command(["chmod", "u=rwx,g=rx,o=rx", os.path.join(root, "data")])
if os.path.exists(os.path.join(root, "data/subsystems")):
run_command(["chmod", "-R", "u=rwx,g=rx,o=rx", os.path.join(root, "data/subsystems")])
if setup_machine_id:
with contextlib.suppress(FileNotFoundError):