Mystery Data
  • Home
  • Tutorials
    • WordPress
    • Linux
    • Centos
    • MySQL/MariaDB
  • Control Panel
    • CWP
    • Vesta CP
  • Contact Me
  • Privacy Policy

Mystery Data

  • Home
  • Tutorials
    • WordPress
    • Linux
    • Centos
    • MySQL/MariaDB
  • Control Panel
    • CWP
    • Vesta CP
  • Contact Me
  • Privacy Policy
CentosControl PanelCWP

How to Enable open_basedir with suPHP globally and for Per User Basis on CWP – Centos WebPanel

by Sandy July 21, 2018
written by Sandy July 21, 2018

In this tutorial we’ll enable open_basedir restriction globally for all user accounts or for each user accounts on your CWP server. It will increase your server security by limiting the access. CWP uses suPHP by default hence open_basedir can’t be enabled via apache vhost or .htaccess file with this options : php_admin_value open_basedir

open_basedir limits all I/O operations in userspace PHP to a certain configurable subset of the filesystem, in particular to a number of directories and their sub-directories,

it is mainly used to avoid modifications to the filesystem (part of) and other user accounts. It can also be used to mitigate the effect of vulnerable PHP scripts on the filesystems/server.

Lets Get Started, it is easy tutorial yet security benefit when combine with CWP suPHP :-

To enable Globally for all CWP user accounts

touch /usr/local/php/php.d/openbasedir.ini
echo "open_basedir = /home:/tmp:/var/tmp:/usr/local/lib/php/" > /usr/local/php/php.d/openbasedir.ini
service httpd restart

TO enable per user basis follow this guide :

## Create php.ini :
/home/username/public_html/php.ini
## or open the exisiting php.ini and add this line :
open_basedir = /home/username:/tmp:/var/tmp:/usr/local/lib/php/

## then restart apache service :
service httpd restart

**Replace the username with the actual user name listed in “List account”

You can also do it by yourself by creating a file: /usr/local/php/php.d/open_basedir.ini with the following content:

open_basedir = /home:/tmp:/var/tmp:/usr/local/lib/php/

To enable it for other php versions from the PHP selector you can create this config files with the same content:

/opt/alt/php44/usr/php/php.d/open_basedir.ini
/opt/alt/php52/usr/php/php.d/open_basedir.ini
/opt/alt/php53/usr/php/php.d/open_basedir.ini
/opt/alt/php54/usr/php/php.d/open_basedir.ini
/opt/alt/php55/usr/php/php.d/open_basedir.ini
/opt/alt/php56/usr/php/php.d/open_basedir.ini
/opt/alt/php70/usr/php/php.d/open_basedir.ini
/opt/alt/php71/usr/php/php.d/open_basedir.ini
/opt/alt/php72/usr/php/php.d/open_basedir.ini
/opt/alt/php7/usr/php/php.d/open_basedir.ini

Done you’ve just enabled open_basedir config for CWP suphp

If this post helps you in any way please consider a donation

md-donate
0 comment
1
FacebookTwitterGoogle +Pinterest
previous post
How to Install MongoDB 4.0 on Centos 7/RHEL 7
next post
How to Install Memcached and Redis PHP Extensions with Php Selector 5.6/7.0/7.1/7.2 CWP- Centos WebPanel

You may also like

How to Upgrade PHP 5.6 to PHP 7.3...

December 29, 2018

How to Install/build PHP 7.3 manually on CWP...

December 29, 2018

Update/Upgrade to MariaDB 10.3 on VestaCP/CWP/CentOS 7

September 8, 2018

Upgrade/Update to Latest Version of TeamSpeak 3 in...

September 1, 2018

Increase Import/Upload limit for phpMyAdmin and File Manager...

August 27, 2018

How to Enable HTTP/2 for Apache in CWP...

August 17, 2018

How to Configure/Install Let’s Encrypt SSL on VestaCP...

August 12, 2018

How to Install CyberPanel – OpenLiteSpeed Control Panel...

July 24, 2018

How to Install Memcached and Redis PHP Extensions...

July 23, 2018

How to Install MongoDB 4.0 on Centos 7/RHEL...

July 17, 2018

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

md-donate

Recent Posts

  • How to Upgrade PHP 5.6 to PHP 7.3 on CentOS VestaCP
  • How to Install/build PHP 7.3 manually on CWP – Centos Web Panel
  • Update/Upgrade to MariaDB 10.3 on VestaCP/CWP/CentOS 7
  • Upgrade/Update to Latest Version of TeamSpeak 3 in CWP
  • Increase Import/Upload limit for phpMyAdmin and File Manager in CWP
  • How to Enable HTTP/2 for Apache in CWP with mod_http2 module
  • How to Configure/Install Let’s Encrypt SSL on VestaCP Mail Server and Vesta Admin – CentOS and Ubuntu
  • How to Install CyberPanel – OpenLiteSpeed Control Panel on Centos 7
  • How to Install Memcached and Redis PHP Extensions with Php Selector 5.6/7.0/7.1/7.2 CWP- Centos WebPanel
  • How to Enable open_basedir with suPHP globally and for Per User Basis on CWP – Centos WebPanel
Footer Logo

Copyright - Mystery Data