Permissions Fix

Discussion in 'General' started by critorix, Aug 23, 2015.

  1. critorix

    critorix New Member

    Hi,

    I had to restore a backup of my server, unfortunately the permissions of a lot of files had changed.
    I fixed some of them (vmail, ...), but for the web, it's not so simple (user and group name)

    So here is my question : is there a script to fix the www permissions or even better all the ispconfig permissions ?

    Thanks in advance.
    Best Regards,
    Critorix
     
  2. critorix

    critorix New Member

    I quickly made a little script, may be it can help someone else :

    Code:
    <?php
    $servername = "localhost";
    $username = "root";
    $password = "XXXXXXXXX";
    $dbname = "dbispconfig";
    
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }        
    
    $sql = "SELECT document_root, system_user, system_group FROM web_domain";
    $result = $conn->query($sql);
    
    if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc())
        {
        if ($row['system_user'] != "" && $row['system_group'] != "")
            {
            exec ("chown -R ".$row['system_user']. ":".$row['system_group'] . " " . $row['document_root']);  
            }
        }
    } else {
        echo "0 results";
    }
    $conn->close();
    ?>
    Best Regards,
    critorix
     
    till likes this.

Share This Page