#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: https://mirrors.slickstack.io/bash/ss-perms-wordpress-cli.txt ######################### #### path: /var/www/ss-perms-wordpress-cli ######################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Resets all file and user permissions across the entire WP-CLI module ################# #### module version: WordPress 6.0.x ############################################################### #### sourced by: ss-perms, ss-install-wordpress-cli ################################################ #### bash aliases: ss perms wordpress cli, ss perms wp cli, ss perms wp-cli ######################## #################################################################################################### ## source ss-config ## source /var/www/ss-config ## source ss-functions ## source /var/www/ss-functions ## BELOW THIS RELIES ON SS-CONFIG AND SS-FUNCTIONS #################################################################################################### #### TABLE OF CONTENTS (SS-Perms-WordPress-CLI) #################################################### #################################################################################################### ## this is a brief summary of the different code snippets you will find in this script ## ## each section should be commented so you understand what is being accomplished ## ## A. Touch Timestamp File ## B. Message (Begin Script) #################################################################################################### #### A. SS-Perms-WordPress-CLI: Touch Timestamp File ############################################### #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## ss_touch "${TIMESTAMP_SS_PERMS_WORDPRESS_CLI}" #################################################################################################### #### B. SS-Perms-WordPress-CLI: Message (Begin Script) ############################################# #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## ss_echo "${COLOR_INFO}Running ss-perms-wordpress-cli... ${COLOR_RESET}" #################################################################################################### #### SS-Perms-WordPress-CLI: Reset Permissions (WP-CLI) ############################################ #################################################################################################### ## always run WP-CLI as the www-data user (and allow SFTP user to run it) ## ## reset permissions ## chown www-data:www-data /usr/local/bin/wp chown www-data:www-data /var/www/meta/wp-cli.yml chown www-data:www-data /var/www/meta/.wp-completion chmod 0755 /usr/local/bin/wp chmod 0755 /var/www/meta/wp-cli.yml chmod 0755 /var/www/meta/.wp-completion #################################################################################################### #### PLACEHOLDER: Reset Permissions (SlickStack Scripts) ########################################### #################################################################################################### ## we include this permissions reset in all cron jobs and bash scripts for redundancy ## ## chmod 0700 means only the root/sudo users can execute any SlickStack scripts ## ## THIS SNIPPET DOES NOT RELY ON SS-CONFIG OR SS-FUNCTIONS ## SNIPPET: ss bash scripts, ss cron jobs ## UPDATED: 02JUL2022 chown root:root /var/www/ss* ## must be root:root chown root:root /var/www/crons/*cron* ## must be root:root chown root:root /var/www/crons/custom/*cron* ## must be root:root chmod 0700 /var/www/ss* ## 0700 means only root/sudo can execute chmod 0700 /var/www/crons/*cron* ## 0700 means only root/sudo can execute chmod 0700 /var/www/crons/custom/*cron* ## 0700 means only root/sudo can execute #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: https://github.com/wp-cli/wp-cli/issues/4797 ## SS_EOF