| 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 : |
#!/bin/bash
set -euo pipefail
if [[ $# -lt 2 ]]; then
echo "Uso: $0 <site_user> <site_dir>"
exit 1
fi
site_user="$1"
site_dir="$2"
if ! [[ "$site_user" =~ ^[a-z_][a-z0-9_-]{0,31}$ ]]; then
echo "Error: site_user invalido"
exit 1
fi
if [[ ! -d "$site_dir" ]]; then
echo "Error: el directorio del sitio no existe: $site_dir"
exit 1
fi
if ! id "$site_user" >/dev/null 2>&1; then
sudo useradd -r -d "$site_dir" -s /usr/sbin/nologin "$site_user"
fi
sudo chown -R "$site_user:$site_user" "$site_dir"
sudo find "$site_dir" -type d -exec chmod 750 {} \;
sudo find "$site_dir" -type f -exec chmod 640 {} \;
if [[ -d "$site_dir/wp-content" ]]; then
sudo chown -R "$site_user:www-data" "$site_dir/wp-content"
sudo find "$site_dir/wp-content" -type d -exec chmod 775 {} \;
sudo find "$site_dir/wp-content" -type f -exec chmod 664 {} \;
fi
echo "OK"
echo "Usuario: $site_user"
echo "Sitio: $site_dir"
echo "Modo: mod_php (aislamiento por permisos)"