[BUGFIX] Fix file ownership of config files created in arm_user_files_setup.sh#1660
[BUGFIX] Fix file ownership of config files created in arm_user_files_setup.sh#1660dkreth wants to merge 5 commits intoautomatic-ripping-machine:mainfrom
Conversation
When config files are copied from /opt/arm/setup/ to /etc/arm/config/, they retain ownership (see man page for cp). If the startup script runs as root, then the config files are created in /etc/arm/config and owned by root. This prevents the arm user from modifying the config files via the web UI, causing a 500 error when attempting to save settings. Add chown command after cp to ensure config files are owned by the arm user, matching the ownership requirements of the config directory.
microtechno9000
left a comment
There was a problem hiding this comment.
agree with change to remove depreciated cp command
The container uses coreutils 8.32, which doesn't support --update=none (introduced in coreutils 9.1). Reverting to --no-clobber to maintain compatibility while keeping the chown fix. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
I reverted the change to remove the deprecated cp command. The container uses coreutils 8.32, which doesn't support |
|
Just tested this. Script Output: File Ownership Result: So both |
ProblemI just found an issue that was fixed by this commit but may still be present according to this issue from August 2024. So... I'm concerned that my fix that's being introducing in this PR (adding the chown command) will cause the GitHub issue above to regress/reoccur. @microtechno9000 I had a couple ideas, but curious on your thoughts here. Option 1I looked for a flag we could pass to the cp command, but didn't see one that fits our use case. The Option 2Another option would be to create the file as the I believe this would work because the script already runs as If so, I think this would be the cleanest solution:
Option 3Alternatively, the simplest option would be to just attempt the |
This has indeed been an issue that keeps coming up, in particular because ARM uses a privileged container due to needing access to CD/DVD/Bluray drives and GPU compute. There are ways around this, but not easily. I think Option 2 is the best, it will avoid NFS permissions issues (NFS can be fun at the best of times) and avoid ARM changing permissions outside a container. If you update the code to Option 2 I can merge in |
microtechno9000
left a comment
There was a problem hiding this comment.
pending change, update to option 2 and remove 'chown'
|
Option 4 is just using the ❯ man install
NAME
install - copy files and set attributes
SYNOPSIS
install [OPTION]... [-T] SOURCE DEST
install [OPTION]... SOURCE... DIRECTORY
install [OPTION]... -t DIRECTORY SOURCE...
install [OPTION]... -d DIRECTORY...
…
-g, --group=GROUP
set group ownership, instead of process' current group
-m, --mode=MODE
set permission mode (as in chmod), instead of rwxr-xr-x
-o, --owner=OWNER
set ownership (super-user only)
…On a side note, the |
…ping-machine#1605, automatic-ripping-machine#1660 PR automatic-ripping-machine#1698 — Main feature chapters/filesize sorting: - Add chapters (Integer) and filesize (BigInteger) to Track model - Parse MakeMKV TINFO fields 8 (chapters) and 11 (filesize) - Sort main feature by chapters desc, length desc, filesize desc, track_number asc — fixes Disney Blu-ray playlist obfuscation - Add BigInteger to database layer exports - Migration: a4b5c6d7e8f9 PR automatic-ripping-machine#1605 — TV series disc label parsing: - Add parse_disc_label_for_identifiers() for labels like STARGATE_ATLANTIS_S1_D2 → S1D2 - Add normalize_series_name() and get_tv_folder_name() - Integrate into Job.build_final_path() for TV series - Config keys: USE_DISC_LABEL_FOR_TV, GROUP_TV_DISCS_UNDER_SERIES - Migration: b5c6d7e8f9a0 PR automatic-ripping-machine#1660 — Config file ownership fix: - Replace cp --no-clobber with install -o arm -g arm -m 644 in arm_user_files_setup.sh to set ownership atomically Includes 33 new tests covering all three features.
…ping-machine#1605, automatic-ripping-machine#1660 PR automatic-ripping-machine#1698 — Main feature chapters/filesize sorting: - Add chapters (Integer) and filesize (BigInteger) to Track model - Parse MakeMKV TINFO fields 8 (chapters) and 11 (filesize) - Sort main feature by chapters desc, length desc, filesize desc, track_number asc — fixes Disney Blu-ray playlist obfuscation - Add BigInteger to database layer exports - Migration: a4b5c6d7e8f9 PR automatic-ripping-machine#1605 — TV series disc label parsing: - Add parse_disc_label_for_identifiers() for labels like STARGATE_ATLANTIS_S1_D2 → S1D2 - Add normalize_series_name() and get_tv_folder_name() - Integrate into Job.build_final_path() for TV series - Config keys: USE_DISC_LABEL_FOR_TV, GROUP_TV_DISCS_UNDER_SERIES - Migration: b5c6d7e8f9a0 PR automatic-ripping-machine#1660 — Config file ownership fix: - Replace cp --no-clobber with install -o arm -g arm -m 644 in arm_user_files_setup.sh to set ownership atomically Includes 33 new tests covering all three features.
…e#1660) - Use 'install -o arm -g arm' for abcde.conf (was plain cp, created as root) - Restore arm.yaml ownership after sed -i overrides (sed resets to root)
…e#1660) - Use 'install -o arm -g arm' for abcde.conf (was plain cp, created as root) - Restore arm.yaml ownership after sed -i overrides (sed resets to root)



Description
When config files are copied from
/opt/arm/setup/to/etc/arm/config/, they retain ownership (see man page for cp). If the startup script runs as root, then the config files are created in/etc/arm/configand owned by root. This prevents thearmuser from modifying the config files via the web UI, causing a 500 error when attempting to save settings in the ARM UI.To fix this, we add a
chowncommand after cp to ensure config files are owned by thearmuser, matching the ownership requirements of the/etc/arm/configdirectory.Fixes #1639 #1599
Type of change
How Has This Been Tested?
Checklist:
Changelog:
chowncommand after cp to ensure config files are owned by thearmuser