User en Group changed on all websites after adding site/domain

Discussion in 'General' started by Jorem, Oct 5, 2010.

  1. Jorem

    Jorem Member

    Big problems, a lot of mailboxes are down, and websites are not running because of the wrong file rights (775).

    Yesterday I added a domain and now all the websites folders are changed to that group. The user changed to apache. And all files are 775 now.

    Even /var/www was set to that user and group.

    What I did so far:
    - changed the logsize in de database, set all the user stats to u (update). Ran touch /home/admispconfig/ispconfig/.run to update them. A lot of the users where changed in the user directory, but not the group.
    - changed the web size and saved. Al lot of users changed again on the files, but still no group changes.

    What do I have to do/run/change to change all the users and groups to the correct ones?
    What do I have to do to have the files changed to 755 again, and nog 775 like they are now?
  2. falko

    falko Super Moderator ISPConfig Developer

    Please use the chown command to correct this.
    man chown
    Use the chmod command:
    man chmod
    What's your ISPConfig version?
  3. Jorem

    Jorem Member

    Thanks for the reply falko.

    This is what I did to get everything running again.
    This can be a lot of work, but with a xml template I could create a webpage that generated this commands for all websites on my system.

    First I changed the ssi to 1 on all website in the database with the sql command:
    UPDATE `isp_isp_web` SET `web_ssi` = '1';

    Than changed the status to u (update):
    UPDATE `isp_isp_web` SET `status` = 'u';

    Also changed user setting (you can set this back afterwards)
    UPDATE `isp_isp_user` SET `spam_rewrite_subject` = '0';
    Ans set the status to update.
    UPDATE `isp_isp_web` SET `status` = 'u';

    Than I ran the command: touch /home/admispconfig/ispconfig/.run

    The website user on the folders in /var/www and a lot of subdirectories allready changed. But not all and permissions were still 775 on all files.

    To change the rest of the files I did this:
    cd /var/www
    find . -type d -print0 | xargs -0 chmod 755
    find . -type f -print0 | xargs -0 chmod 644

    changes all folder permissions to 755 and files permissions to 644

    chown root:root cgi-bin
    chown root:root error
    chown root:root html
    chown root:root icons
    chown root:root manual
    chown root:root localhost

    default files/folder to user and group root

    chown -R adminusername:web10 --from=apache:web231 web10

    changes the wrong user=apache and group=web231 to user=adminusername and group to the name op de website folder (web10 for example). Last is to do this in the folder web10

    chown -R :web10 --from=:web231 web10

    change all groups that are set to web231 to web10 in folder web10

    cd web10
    chown root:root .procmailrc
    chown root:root .forward
    chown root:root .spamassassin
    chown root:root .vacation.cache
    chown root:root Maildir
    chown root:root passwd.dav

    changes default files/folders user and group to root

    /// Extra. for my CMS I used this to changes the permissions of some files and directories. You can change these to your own needs. This a just as an example (for CMSMS).

    cd web
    chmod 644 config.php
    chmod 777 -R uploads
    chmod 777 tmp
    cd tmp
    chmod 777 cache
    chmod 777 templates_c

    After changing all the files the server ran fine again :D.
    Last edited: Oct 6, 2010

Share This Page