• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Events and the order they are executed in

KarelB

New Pleskian
I made a small script that sets some permissions of a subdomain after being created:

Code:
#!/bin/bash
SUBSCRIPTION_DIR=/var/www/vhosts/${NEW_DOMAIN_NAME}
SUBDOMAIN_DIR=$SUBSCRIPTION_DIR/${NEW_SUBDOMAIN_NAME}.${NEW_DOMAIN_NAME}

# Fix permissions for the subscription basedir
chmod 755 $SUBSCRIPTION_DIR

# Fix permissions for the subdomain
chown -R karel $SUBDOMAIN_DIR
#chown -R ${NEW_SUBDOMAIN_NAME} $SUBDOMAIN_DIR
chmod 755 $SUBDOMAIN_DIR
#rm -rf $SUBDOMAIN_DIR/www

The script works fine, but the chmod and chown commands are not working. I think they are working, but that the builtin Plesk commands that change permissions and owners overwrite my changes made in my custom script.

I tried playing around with the priority from 0 to 100, but that didn't fix it.

Any suggestions on how to fix this? I really want to be able to alter these permissions and owners after creating a subdom
 
Last edited:
Plesk will always fix these permissions on updates and other circumstances ...
Am not sure if
Code:
chattr
can help you here ...

Code:
man chattr
For details
 
I don't see how chattr could help me here.

I've started looking where Plesk determines what the permissions of the subdomain folder should be, some template or config script? But I haven't found it so far.
 
Instead of meddling with plesk's engine fines (which could lead your server into serious trouble), why don't you just create a cron job that runs every (say 5 mins) to check if permissions have changed and change them back to your preference...
 
I can think of a 101 of those hacky solutions to work around this problem, but doing this with event hooks is the proper way to do it. And doing it the proper way is how I still prefer to do things as a programmer.
 
The post you linked didn't help me, as you read in his 2nd post his problem was something else so he didn't go through with the event manager solution.

But I did figure out what the problem was: the event wasn't being overwritten, my actions were taking place before the subdomain directory had actually been created.
So adding a simple "mkdir -p $SUDOMAIN_DIR" to my script before setting the permissions finally made it work like I wanted to.
 
Back
Top