[Synology] Post processing script change owner + permissions

Come up with a useful post-processing script? Share it here!
Post Reply
banaandigitaal
Newbie
Newbie
Posts: 1
Joined: September 3rd, 2016, 10:56 am

[Synology] Post processing script change owner + permissions

Post by banaandigitaal »

Hi, i'm looking for a post processing script that changes file/folder owner and sets correct permissions to specified users and/or groups.
I managed to setup a script (found on the web), but after post processing it states post processing failed.
I suppose this has to to with sabnzbd running under the 'sabnzbd' user and has insufficient rights to change owner/permissions.
If sabnzbd were running under 'root' i suppose things would have worked out better..

The script i currenty use:

Code: Select all

    #!/bin/sh
    # Owner Changer for SABnzbd
    # By Mohinder <[email protected]>

    # Define the username, group and permissions to apply here
    USER="admin"
    GROUP="users"
    FOLDERS="777"
    FILES="777"

    # Human readable variables
    DESTINATION=$1

    # Running the script
    chown -R $USER:$GROUP "$DESTINATION"
    find "$DESTINATION" -type d | while read i; do chmod $FOLDERS "$i"; done
    find "$DESTINATION" -type f | while read i; do chmod $FILES "$i"; done

    echo "Owner and permissions changed successfully."
And the current script output:

Code: Select all

chown: changing ownership of ‘/volume1/Downloads/downloads-voltooid/Mr_ Robot S02E08 1080p WEB-DL DD5_1-NL Subs/mg6602xc4robjsnhpewt04cz/m4zjezmfuo3xahag0qb.mkv’: Operation not permitted
chown: changing ownership of ‘/volume1/Downloads/downloads-voltooid/Mr_ Robot S02E08 1080p WEB-DL DD5_1-NL Subs/mg6602xc4robjsnhpewt04cz/m4zjezmfuo3xahag0qb.par2’: Operation not permitted
chown: changing ownership of ‘/volume1/Downloads/downloads-voltooid/Mr_ Robot S02E08 1080p WEB-DL DD5_1-NL Subs/mg6602xc4robjsnhpewt04cz’: Operation not permitted
chown: changing ownership of ‘/volume1/Downloads/downloads-voltooid/Mr_ Robot S02E08 1080p WEB-DL DD5_1-NL Subs/yEncBin_Temp0001’: Operation not permitted
chown: changing ownership of ‘/volume1/Downloads/downloads-voltooid/Mr_ Robot S02E08 1080p WEB-DL DD5_1-NL Subs’: Operation not permitted
Owner and permissions changed successfully.
To be sure i chmod'd the download folder and script to 0777. All 'users' have full permissions there.

Any idea's?
Post Reply