Documentation

Obtain Read/Write Access to the Web Server Document Root Directory

By default, the Web server document root directory (/opt/lampp/htdocs) is configured to only allow write access to the root user. However, in most cases, you will be using XAMPP as a non-root user and this can be inconvenient if you need to quickly modify or add files to your XAMPP installation.

In these situations, you can give one or more user accounts privileges to write to the Web server document root directory. Follow these steps:

  1. Open a new Linux terminal and ensure you are logged in as root.

  2. Create a new group named xamppusers. This group will contain those user accounts allowed read/write access to the Web server document root directory.

    groupadd xamppusers
    image1
  3. Add your account (in this example, susan) to the new group. Add other users if needed.

    usermod -a -G xamppusers susan
    image2
  4. Change the ownership and permissions of the htdocs/ subdirectory so that it is writable by the the new xamppusers group.

    cd /opt/lampp
    chown root.xamppusers htdocs
    chmod 775 htdocs
    image3
    If you’re using XAMPP in a single-user scenario and there will only be one user ever accessing the Web server document root directory, you can skip creating a new group and instead simply transfer full ownership of the htdocs/ directory to that user. To do this, use a command like chown susan.susan htdocs.

You should now be able to log in again as the specified user account and read/write to the Web server document root.

image4