Setting up a NAS on a Raspberry Pi 5 that boots from NVME

# curl https://download.argon40.com/argonneo5.sh | bash
# nano /boot/firmware/config.txt

kernel=kernel8.img
dtparam=nvme
dtparam=pciex1_gen=3
usb_max_current_enable=1

# sudo apt update
# sudo apt install snapd
# sudo snap install snapd
# sudo snap install nextcloud
# sudo /snap/bin/nextcloud.enable-https lets-encrypt
# sudo /snap/bin/nextcloud.occ maintenance:repair --include-expensive
# sudo /snap/bin/nextcloud.occ background:cron
# apt install syncthing
# systemctl enable syncthing@pi-nas.service
# systemctl start syncthing@pi-nas.service
# nano /usr/lib/systemd/system/syncthing@.service

Group=users
UMask=0002

# apt install proftpd
# nano /etc/proftpd/proftpd.conf

DefaultRoot ~
Umask 002 002

# nano /usr/local/bin/fix_ownership.sh

#!/bin/bash
WATCHDIR="/volume1"
LOGFILE="/var/log/fix_ownership.log"

# Function to fix ownership of a file or directory
fix_ownership() {
    local file="$1"
    if [ -e "$file" ]; then
        if [ -d "$file" ]; then
            chown -R pi-nas:users "$file" 2>/dev/null
        else
            chown pi-nas:users "$file" 2>/dev/null
        fi
        echo "$(date '+%Y-%m-%d %H:%M:%S') Fixed ownership: $file" >> "$LOGFILE"
    fi
}

# Watch for changes
inotifywait -m -r -e close_write,create,move,delete --format '%w%f' "$WATCHDIR" | while read -r file; do
    fix_ownership "$file"
done

# nano /etc/systemd/system/fix_ownership.service

[Unit]
Description=Recursive ownership watcher for Volume1 folder
After=network.target

[Service]
ExecStart=/usr/local/bin/fix_ownership.sh
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

# systemctl daemon-reload
# systemctl enable fix_ownership.service
# systemctl start fix_ownership.service