diff --git a/Bash/linuxUpdate.sh b/Bash/linuxUpdate.sh new file mode 100644 index 0000000..3181c39 --- /dev/null +++ b/Bash/linuxUpdate.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Bash script for updating Linux +# Author: Floris van Enter +# Date: 2018-01-30 + +sudo apt-get update +sudo apt-get -y upgrade +sudo apt-get -y dist-upgrade +sudo apt-get -y autoremove +sudo reboot \ No newline at end of file diff --git a/Bash/set_wordpress_rights.sh b/Bash/set_wordpress_rights.sh new file mode 100755 index 0000000..0db7e27 --- /dev/null +++ b/Bash/set_wordpress_rights.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# This script configures WordPress file permissions based on recommendations +# from http://codex.wordpress.org/Hardening_WordPress#File_permissions +# +# Author: Michael Conigliaro +# Original script: https://gist.github.com/macbleser/9136424 +# +WP_OWNER=users. # <-- wordpress owner +WP_GROUP=www-data # <-- wordpress group +WP_ROOT=/var/www/wordpress # <-- wordpress root directory +WS_GROUP=www-data # <-- webserver group + +# reset to safe defaults +find ${WP_ROOT} -exec chown ${WP_OWNER}:${WP_GROUP} {} \; +find ${WP_ROOT} -type d -exec chmod 755 {} \; +find ${WP_ROOT} -type f -exec chmod 644 {} \; + +# allow wordpress to manage wp-config.php (but prevent world access) +chgrp ${WS_GROUP} ${WP_ROOT}/wp-config.php +chmod 660 ${WP_ROOT}/wp-config.php + +# allow wordpress to manage .htaccess +touch ${WP_ROOT}/.htaccess +chgrp ${WS_GROUP} ${WP_ROOT}/.htaccess +chmod 664 ${WP_ROOT}/.htaccess + +# allow wordpress to manage wp-content +find ${WP_ROOT}/wp-content -exec chgrp ${WS_GROUP} {} \; +find ${WP_ROOT}/wp-content -type d -exec chmod 775 {} \; +find ${WP_ROOT}/wp-content -type f -exec chmod 664 {} \; \ No newline at end of file