HEX
Server: CentOS WebPanel: Protected by Mod Security
System: Linux sites.annaiservers.com 3.10.0-1160.118.1.el7.x86_64 #1 SMP Wed Apr 24 16:01:50 UTC 2024 x86_64
User: freeval (1012)
PHP: 8.1.10
Disabled: NONE
Upload Files
File: //scripts/open_basedir-suphp
#!/bin/bash
# this script will activate and force open_basedir for all users
# by activating open_basedir custom php.ini per forlder will be also disabled


for USER in $(ls /home);do

	if [ -e "/home/$USER/" ];then
		if [ ! -f /home/$USER/php.ini ]; then
		    echo "open_basedir = /home/$USER:/tmp:/var/tmp:/usr/local/lib/php/" >> /home/$USER/php.ini
		    chmod 0555 /home/$USER/php.ini
		    chown root.root /home/$USER/php.ini
		elif ! grep -q "^open_basedir" "/home/$USER/php.ini"; then
		    echo "open_basedir = /home/$USER:/tmp:/var/tmp:/usr/local/lib/php/" >> /home/$USER/php.ini
		    chmod 0555 /home/$USER/php.ini
		    chown root.root /home/$USER/php.ini
		else
		    echo "/home/$USER/php.ini already has open_userdir configuration"
		fi
	fi

done