Adding "secure_access_group" to "domain_create_post.sh" script

Scolpy

Verified User
Joined
Feb 25, 2009
Messages
142
Hey!

There is a variable of "secure_access_group" feature to use inside the "domain_create_post.sh" script?

For example, I have this code:
Code:
#!/bin/sh
WEB_PATH=~${username}/domains/${domain}/public_html
chown ${username}:${username} $WEB_PATH
chmod 755 $WEB_PATH
exit 0;
So, Instead of:
Code:
chown ${username}:${[B]username[/B]} $WEB_PATH
I need to use in something like:
Code:
chown ${username}:${[B]secure_access_group[/B]} $WEB_PATH
Thank you!
 
Last edited:

mr.applesauce

Verified User
Joined
Jun 3, 2009
Messages
557
If its a shell script then im sure you can make a variable like

secure_access_group=$(cat /usr/local/directadmin/conf/directadmin.conf | grep secure_access_group | cut -d= -f2)
 

Scolpy

Verified User
Joined
Feb 25, 2009
Messages
142
If its a shell script then im sure you can make a variable like

secure_access_group=$(cat /usr/local/directadmin/conf/directadmin.conf | grep secure_access_group | cut -d= -f2)
Thanks!

I've created the script with this content:
Code:
#!/bin/sh
secure_access_group=$(cat /usr/local/directadmin/conf/directadmin.conf | grep secure_access_group | cut -d= -f2) 
WEB_PATH=~${username}/domains/${domain}/public_html
chown ${username}:${secure_access_group} $WEB_PATH
chmod 755 $WEB_PATH
exit 0;
But after I've created some domain, I saw that it didn't actually changed anything in the ownership and the public_html still USERNAME:USERNAME instead of USERNAME:SECURE_ACCESS_GROUP.

what I did wrong?
 
Last edited:

Richard G

Verified User
Joined
Jul 6, 2008
Messages
4,272
Location
Maastricht
Try using it in the user_create_post.sh because you created a user in the first place.
I had kindlike problem with domain_create_post.sh and some rights of something else too. Maybe you can maken them in both so that domain does not overwrite things wrongly when creating another domain for the user.
 

Scolpy

Verified User
Joined
Feb 25, 2009
Messages
142
Try using it in the user_create_post.sh because you created a user in the first place.
I had kindlike problem with domain_create_post.sh and some rights of something else too. Maybe you can maken them in both so that domain does not overwrite things wrongly when creating another domain for the user.
I don't think so because after I've created the domain, I got this message:
Domain Created

Details

Script output: domain_create_post.sh

Domain Created Successfully
which mean that just "domain_create_post.sh" script executed after the domain has created.

P.S.
I've tried to do so, just in case it will work. but as I thought - it didn't work.

Thank you anyway for your desire to help :)
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,961
Hello,

I'd recommend grabbing the secure_access_group variable from the directadmin binary, in case it's using an internal default.

eg:
Code:
secure_access_group=`/usr/local/directadmin/directadmin c | grep secure_access_group |  cut -d= -f2`
Also, try generating some debug output to ensure your variables are as exepected, eg:
Code:
echo "user: $username" >> /tmp/test.log
echo "domain: $domain" >> /tmp/test.log
echo "sag: $secure_access_group" >> /tmp/test.log
echo "path: $WEB_PATH" >> /tmp/test.log
As usual, ensure you've set the domain_create_post.sh to 755.
You should also be able to test it manually (depending on the shell you're using), eg:
Code:
cd /usr/local/directadmin/scripts/custom
user=[b]testuser[/b] domain=[b]domain.com[/b] ./domain_create_post.sh
John
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,791
Location
A Coruña, Spain
Ive a question about this.

I use to set public_html to 710 user:user with mod-ruid2 and /home/user with user:accessgroup 710.

Is this correct?

Why set access group to public_html?

Regards
 

Scolpy

Verified User
Joined
Feb 25, 2009
Messages
142
Ive a question about this.

I use to set public_html to 710 user:user with mod-ruid2 and /home/user with user:accessgroup 710.

Is this correct?

Why set access group to public_html?

Regards
Yes, you don't need to set the "secure_access_group" to public_html also.
 
Top