Author Topic: Create extra folder in home directory when creating users  (Read 177 times)

0 Members and 2 Guests are viewing this topic.

Offline
*
Create extra folder in home directory when creating users
« on: September 18, 2024, 07:47:59 AM »
Hello,

I created a specific virtual host template for websites.
I want to host the log files under the home directory

This is what I added :

   # CustomLog /home/kockel/logs/kockel.be.bytes bytes
   CustomLog /home/kockel/logs/kockel.be.log combined
   ErrorLog /home/kockel/logs/kockel.be.error.log

Everything is created fine when creating a new user.
Only big issue : the logs folder is NOT created...
When rebooting apache, it fails...

Anyone has a solution for this? Are there any template folders that I need to adjust? or a script?

Offline
**
Re: Create extra folder in home directory when creating users
« Reply #1 on: September 18, 2024, 08:26:52 PM »
Use CWP Account Hooks:
https://wiki.centos-webpanel.com/action-hooks
to create folders inside the account.

Offline
*
Re: Create extra folder in home directory when creating users
« Reply #2 on: September 25, 2024, 01:49:01 PM »
<?php
function account_new($array){
        mkdir("/home/$array[username]/logs", 0755);
}
?>

Solved with cwp hooks