#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: https://mirrors.slickstack.io/bash/ss-perms-ubuntu-swapfile.txt ####################### #### path: /var/www/ss-perms-ubuntu-swapfile ####################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Resets all file and user permissions for the Ubuntu swapfile ######################### #### module version: Ubuntu 20.04 LTS ############################################################## #### sourced by: ss-perms, ss-install-ubuntu-swapfile ############################################## #### bash aliases: ss perms [swap|swapfile], ss perms ubuntu [swap|swapfile] ####################### #################################################################################################### ## 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-Ubuntu-Swapfile) ################################################## #################################################################################################### ## 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-Ubuntu-Swapfile: 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_UBUNTU_SWAPFILE}" #################################################################################################### #### B. SS-Perms-Ubuntu-Swapfile: 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}ss-perms-ubuntu-swapfile: Resets file/user perms for the Linux swapfile... ${COLOR_RESET}" #################################################################################################### #### SS-Perms-Ubuntu-Swap: Reset Permissions (SSH) ################################################# #################################################################################################### mkdir /var/www/cache/system chown root:root /var/www/cache/system ## must be root:root chmod 0600 /var/www/cache/system ## must be 0600 if [[ -f "/var/www/cache/system/swapfile" ]]; then chown root:root /var/www/cache/system/swapfile ## must be root:root chmod 0600 /var/www/cache/system/swapfile ## must be 0600 fi #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: ## SS_EOF