#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: http://mirrors.slickstack.io/bash/ss-perms-ubuntu-bash.txt ############################ #### path: /var/www/ss-perms-ubuntu-bash ########################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Resets file and user permissions for Bash run commands and related files ############# #### module version: Ubuntu 20.04 LTS ############################################################## #### sourced by: ss-perms, ss-install-ubuntu-bash ################################################## #### bash aliases: ss perms ubuntu bash, ss perms bash ############################################# #################################################################################################### ## include SlickStack configuration ## source /var/www/ss-config ## include SlickStack functions ## source /var/www/ss-functions #################################################################################################### #### SS-Perms-Ubuntu-Bash: 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 ## echo -e "${PURPLE}Running ss-perms-ubuntu-bash: Resets file and user permissions for Bash run commands and related files... ${NOCOLOR}" sleep "$SLEEP_MESSAGE_BEGIN" #################################################################################################### #### SS-Perms-Ubuntu-Bash: Reset Permissions (Ubuntu Bash) ######################################### #################################################################################################### ## reset permissions ## chown root:root /var/www/meta/.bash-aliases chmod 6775 /var/www/meta/.bash-aliases ## reset permissions ## chown root:root /usr/local/bin/ 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 chown root:root /home/${SUDO_USER}/.wp-cli/config.yml chown root:root /root/.wp-cli/config.yml chmod 6775 /usr/local/bin/wp chmod 6775 /var/www/meta/wp-cli.yml chmod 6775 /var/www/meta/.wp-completion #################################################################################################### #### SS-Perms-Ubuntu-Bash: Touch Timestamp File (End Script) ####################################### #################################################################################################### ## 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 ## touch /var/www/meta/.timestamp-ss-perms-ubuntu-bash #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: https://www.alexgeorgiou.gr/wp-cli-www-data-user-permissions-linux/ ## SS_EOF