Mappen, bestanden & rechten - 2019 (WordPress)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

Alles wat ik weet, zit in dit script:

#!/bin/bash
#
# Universal routine for fixing folders & rights
##############################################################
#
echo "wp_mappen_en_rechten..."


##############################################################
# Process input arguments
##############################################################
#
pad=$1

if [ -z "$pad" ];	then 
	echo "No path provided"
	exit 
fi

echo "Pad: $pad"

# eigenaar
##########
#
eigenaar="strompf"

##############################################################
# cd $pad
##############################################################
#
cd $pad


##############################################################
# Ownership - All folders, files & dot-files
##############################################################
#
chown -R $eigenaar $pad
chgrp -R $eigenaar $pad

# dot-files
###########
#
# Abbreviating to simply "$/pad/."" doesn't work: It turns
# into ".." and affects the whole computer!
#
chown -R $eigenaar $pad/.htaccess
chgrp -R $eigenaar $pad/.htaccess

# sudo chown -R $eigenaar $pad
# sudo chgrp -R $eigenaar $pad
# sudo chown -R $eigenaar $pad/.*
# sudo chgrp -R $eigenaar $pad/.*

# sudo chown -R $eigenaar $pad/*
# sudo chgrp -R $eigenaar $pad/*
# sudo chown -R $eigenaar $pad/.*
# sudo chgrp -R $eigenaar $pad/.*


##############################################################
# Basic settings - All folders
##############################################################
#
# * Owner: All rights
# * Group: No rights
# * Other: Read & execute (execute = cd)
# * Generates errors on paths with spaces - need to fix
#
chmod -R 705 $(find $pad -type d)

# This doesn't work: All output from find gets concatenated
# into one argument:
#
# chmod -R 705 "$(find $pad -type d)"


##############################################################
# Basic settings - All files
##############################################################
#
# * Owner: Read & write. No execute
# * Group: No rights
# * Other: Read. No write or execute
# * This should also be for dot-files
# * Generates errors for file names with spaces
#
chmod -R 604 $(find $wortel -type f)


##############################################################
# wp-content/uploads
##############################################################
#
chmod -R o+rw wp-content/uploads


##############################################################
# CSS- & JS-files
##############################################################
#
chmod -R o+rw wp-content/themes/hoshi/assets/css
chmod -R o+rw wp-content/themes/hoshi/assets/js

chmod -R o+rw wp-content/themes/twentyseventeen/assets/css
chmod -R o+rw wp-content/themes/twentyseventeen/assets/js