Created
February 8, 2018 10:43
-
-
Save ardevd/1e28ad5cc84e81f5b177d1a3d98625b2 to your computer and use it in GitHub Desktop.
NextCloud folder permissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ncpath='/var/www/nextcloud' | |
htuser='www-data' | |
htgroup='www-data' | |
rootuser='root' | |
printf "Creating possible missing Directories\n" | |
mkdir -p $ncpath/data | |
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}/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 0644 ${ncpath}/.htaccess | |
chown ${rootuser}:${htgroup} ${ncpath}/.htaccess | |
fi | |
if [ -f ${ncpath}/data/.htaccess ] | |
then | |
chmod 0644 ${ncpath}/data/.htaccess | |
chown ${rootuser}:${htgroup} ${ncpath}/data/.htaccess | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment