Cron Job wholesale changes Ownership/Group Of Directories/Files [RESOLVED]

Ok, here goes.

I installed clamav, verified it worked, then set up a cron job. When I did an update to nextcloud it failed; and I ended up re-installing and copying the files back into the new installation. Then I noticed that other apps were behaving weirdly! I had gone through most of my apps this morning and they were all working; now I had various problems. Dropping into the shell and doing a look-see I immediately spotted something strange. Most of my app related directories had ownerships that do not seem correct. The group owner appeared especially suspicious with an owner of systemd-timesync. And I don’t remember an owner of _apt being correct. For example the newly installed nextcloud had ROOT as owner and group.

Looking at the directory where I have most of my app data:

admin@tatooine[/mnt/Main/app_storage]$ ls -l
total 43
drwxr-xr-x 3 _apt systemd-timesync  5 Jul 22 06:12 code-server
drwxrwx--- 5 _apt systemd-timesync  6 Jul 28 07:55 damselfly
drwxrwxrwx 4 _apt systemd-timesync  5 Jul 29 08:54 digikam
drwxr-xr-x 4 _apt systemd-timesync  5 Jul 28 12:34 digislide
drwxr-xr-x 2 _apt systemd-timesync  3 Jul 22 05:05 drawio
drwxr-xr-x 4 _apt systemd-timesync  4 Jan 28  2025 filebrowser
drwxrwx--- 5 _apt systemd-timesync  5 Jul  5 16:27 ha_2025
drwxr-xr-x 3 _apt systemd-timesync  5 Jul 30 14:49 homepage
drwxr-xr-x 2 root root              2 Jul 26 07:06 httpd
drwxr-xr-x 6 _apt systemd-timesync  6 Jun 20 13:49 immich
drwxr-xr-x 3 _apt systemd-timesync  3 Apr 26  2023 iso
drwxrwx--- 5 _apt systemd-timesync  5 Jan 27  2025 jellfyfinix
drwxrwx--- 9 root root              9 Jul 31 15:40 nextcloud
drwxrwxr-x 6 _apt systemd-timesync  6 Jun 10  2024 nextcloud_scale
drwxr-xr-x 3 _apt systemd-timesync  4 Jul 22 05:25 nginx
drwxrwx--- 3 _apt systemd-timesync  3 Jul  5 08:41 pgadmin
drwxrwx--- 9 _apt systemd-timesync 12 Feb 20 20:41 portainer
admin@tatooine[/mnt/Main/app_storage]$

And the pgvecto container of immich (which is cycling between deploying and stopped) has permissions issues:

2025-08-01 02:29:11.951242+00:002025-08-01T02:29:11.951242549Z
2025-08-01 02:29:11.951244+00:00initdb: error: could not access directory "/var/lib/postgresql/data": Permission denied
2025-08-01 02:30:03.721874+00:00Using SSD storage
2025-08-01 02:30:03.730923+00:00chmod: changing permissions of '/var/lib/postgresql/data': Operation not permitted
2025-08-01 02:30:03.749760+00:00The files belonging to this database system will be owned by user "postgres".
2025-08-01 02:30:03.749787+00:00This user must also own the server process.
2025-08-01 02:30:03.749811+00:002025-08-01T02:30:03.749811520Z
2025-08-01 02:30:03.749958+00:00The database cluster will be initialized with locale "en_US.utf8".
2025-08-01 02:30:03.749976+00:00The default database encoding has accordingly been set to "UTF8".
2025-08-01 02:30:03.749985+00:00The default text search configuration will be set to "english".
2025-08-01 02:30:03.750002+00:002025-08-01T02:30:03.750002059Z
2025-08-01 02:30:03.750010+00:00Data page checksums are disabled.
2025-08-01 02:30:03.750019+00:002025-08-01T02:30:03.750019682Z

Digikam:

Log:

2025-07-31 22:31:26.348435+00:00[ls.io-init] done.
2025-07-31 22:31:32.225681+00:00_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
2025-07-31 22:31:32.509478+00:00screen 0 shmid 0
2025-07-31 22:34:55.804900+00:00[migrations] started
2025-07-31 22:34:55.805066+00:00[migrations] no migrations found
2025-07-31 22:34:56.234846+00:00usermod: no changes
2025-07-22:34:56.591998+00:00───────────────────────────────────────
2025-07-31 22:34:56.592029+00:002025-07-31T22:34:56.592029003Z
2025-07-31 22:34:56.592042+00:00██╗ ███████╗██╗ ██████╗
2025-07-31 22:34:56.592054+00:00██║ ██╔════╝██║██╔═══██╗
2025-07-31 22:34:56.592066+00:00██║ ███████╗██║██║ ██║
2025-07-31 22:34:56.592078+00:00██║ ╚════██║██║██║ ██║
2025-07-31 22:34:56.592089+00:00███████╗███████║██║╚██████╔╝
2025-07-31 22:34:56.592102+00:00╚══════╝╚══════╝╚═╝ ╚═════╝
2025-07-31 22:34:56.592113+00:002025-07-31T22:34:56.592113482Z
2025-07-31 22:34:56.592124+00:00Brought to you by linuxserver.io
2025-07-31 22:34:56.592136+00:00───────────────────────────────────────
2025-07-31 22:34:56.592372+00:002025-07-31T22:34:56.592372570Z
2025-07-31 22:34:56.592396+00:00To support LSIO projects visit:
2025-07-31 22:34:56.592407+00:00https://www.linuxserver.io/donate/
2025-07-31 22:34:56.592417+00:002025-07-31T22:34:56.592417355Z
2025-07-31 22:34:56.592427+00:00───────────────────────────────────────
2025-07-31 22:34:56.592438+00:00GID/UID
2025-07-31 22:34:56.592449+00:00───────────────────────────────────────
2025-07-31 22:34:56.595499+00:002025-07-31T22:34:56.595499669Z
2025-07-31 22:34:56.595527+00:00User UID: 1000
2025-07-31 22:34:56.595542+00:00User GID: 1000
2025-07-31 22:34:56.595554+00:00───────────────────────────────────────
2025-07-31 22:34:56.717319+00:00[custom-init] No custom files found, skipping...
2025-07-31 22:34:56.734589+00:00[ls.io-init] done.
2025-07-31 22:34:56.751297+00:00_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
2025-07-31 22:34:56.753306+00:00screen 0 shmid 0

I know some of my apps had admin as owner and group but I don’t know for sure which ones. My IDrive does not seem to show the ownership information.

Before doing something (more) stupid I wanted to run this by the experts ;-).

Thanks,
jengle

I hear you chuckling…

System:

2 Pools:
  1 x RAIDZ1 | 4 wide | 7 TiB
  1 x MIRROR | 2 wide | 5.46 TiB
PC
  ASRock B550M Pro4 w/6 SATA
  AMD Ryzen 5 3600
  64 Gb memory Kingston FURY Beast 64GB (4x16GB) 3200MHz DDR4 CL16 Desktop Memory Kit of 4 KF432C16BBK4/64,Black
 Isolated GPU Device(s): NVIDIA Corporation TU106 [GeForce RTX 2070]
APPS
 damselfly
 digikam
 Nextcloud
 homeassistant
 filebrowser
 jellyfin

SHARES
  SMB shares - One on each pool

FWIW, I updated the ownership to be admin for owner and group for all directories, then re-applied permissions for immich. That resolved most of the issues. That did not resolve digikam, so I just re-installed into a new dataset. Not worth exploring why adding a cron task messed so much up.