diff options
author | Muflone | 2020-05-17 00:56:39 +0200 |
---|---|---|
committer | Muflone | 2020-05-17 00:56:39 +0200 |
commit | cc0a5f60659182cc6d7a7e50d30020d2dbb4b7cb (patch) | |
tree | 8c4257a68c986283ab5b55f7c309a5cacba23977 /nextcloud-set-permissions.sh | |
parent | 0a027e8d29f2c19598d73a1915add7bec75a9bca (diff) | |
download | aur-nextcloud-10.tar.gz |
Updated package nexcloud-10 10.0.6-1
Diffstat (limited to 'nextcloud-set-permissions.sh')
-rwxr-xr-x | nextcloud-set-permissions.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/nextcloud-set-permissions.sh b/nextcloud-set-permissions.sh new file mode 100755 index 000000000000..849b565ad5ad --- /dev/null +++ b/nextcloud-set-permissions.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# from https://docs.nextcloud.org/server/9/admin_manual/installation/installation_wizard.html#strong-perms-label +# run with the argument "runtime" to set the proper runtime permissions +# run with the argument "upgrade" to set the proper upgrade permissions + +if [ -d "$2/apps" ]; then + ncpath="$2" +else + ncpath='/usr/share/webapps/nextcloud' +fi + +htuser='http' +htgroup='http' +rootuser='root' + +runtime() { + printf "Creating possible missing Directories\n" + mkdir -p $ncpath/data + mkdir -p $ncpath/assets + mkdir -p $ncpath/updater + + printf "chmod Files and Directories\n" + find ${ncpath}/ -type f -print0 | xargs -0 chmod 0640 + find ${ncpath}/ -type d -print0 | xargs -0 chmod 0750 + + printf "chown Directories\n" + chown -R ${rootuser}:${htgroup} ${ncpath}/ + chown -R ${htuser}:${htgroup} ${ncpath}/apps/ + chown -R ${htuser}:${htgroup} ${ncpath}/assets/ + chown -R ${htuser}:${htgroup} ${ncpath}/config/ + chown -R ${htuser}:${htgroup} ${ncpath}/data/ + chown -R ${htuser}:${htgroup} ${ncpath}/themes/ + chown -R ${htuser}:${htgroup} ${ncpath}/updater/ + + chmod +x ${ncpath}/occ + + printf "chmod/chown .htaccess\n" + if [ -f ${ncpath}/.htaccess ] + then + chmod 0664 ${ncpath}/.htaccess + chown ${rootuser}:${htgroup} ${ncpath}/.htaccess + fi + if [ -f ${ncpath}/data/.htaccess ] + then + chmod 0664 ${ncpath}/data/.htaccess + chown ${rootuser}:${htgroup} ${ncpath}/data/.htaccess + fi + + printf "chmod/chown .user.ini\n" + if [ -f ${ncpath}/.user.ini ] + then + chmod 0664 ${ncpath}/.user.ini + chown ${rootuser}:${htgroup} ${ncpath}/.htaccess + fi +} + +upgrade() { + printf "Setting upgrade permissions\n" + chown -R ${htuser}:${htgroup} ${ncpath} +} + +$1 |