Password Protecting Awstat folder

that is a linked directory. you can password protect a link directory.

i tried protecting ../awstats (where /public_html/stats is linked to)

but it gives a error on INTERNAL SERVER CONFIG ERROR.

anyone knows how to password protect this /stats folder?
 
that is a linked directory. you can password protect a link directory.

i tried protecting ../awstats (where /public_html/stats is linked to)

but it gives a error on INTERNAL SERVER CONFIG ERROR.

anyone knows how to password protect this /stats folder?

On my servers (70) stats is a real directory not linked to anything. It has links inside of stats but stats itself can be password protected.
 
is there any way to automate this process?
I mean every time a user is created to create the stats folder and password protect
the directory with the password of the user?
 
Yes, DirectAdmin allows you to create a shell script which will run every time a user is created. Search these forums.

Jeff
 
Thanks for the reply Jeff

My only problem before creating this script is the password.
When DA creates a user it creates a password and i think that there isn't a password variable like the username ($username).
 
Hello,

The user_create_post.sh does have a passwd variable (it's passwd, and not passsword)
http://www.directadmin.com/features.php?id=183

However, you really should use the domain_create_post.sh instead of the user_create_post.sh in the event that the existing User creates a 2nd domain.

In that event, if you want the password to match the DA password, then you can grab the hash from /home/username/.shadow and use that in the .htpasswd file. Setup the .htaccess and .htpasswd files manually. No real need to use the API, since it's just some basic file setup.

/home/user/domains/domain.com/.htpasswd/awstats/.htpasswd
/home/user/domains/domain.com/awstats/.htaccess

Set it up through DA once to learn what contents you need to add in your script.

John
 
Hi,

Thanks for your reply John.
I created a very begginer's scirpt for this. :)

touch /usr/local/directadmin/scripts/custom/domain_create_post.sh
chown diradmin.diradmin /usr/local/directadmin/scripts/custom/domain_create_post.sh
chmod +x /usr/local/directadmin/scripts/custom/domain_create_post.sh

--Begin--
mkdir /home/$username/domains/$domain/.htpasswd/awstats/
touch /home/$username/domains/$domain/.htpasswd/awstats/.htpasswd
echo $username /home/$username/domains/$domain/.htpasswd/awstats/.htpasswd
tmpPass=`cat /home/$username/.shadow`
tmpUser=$username:
echo $tmpUser$tmpPass >> /home/$username/domains/$domain/.htpasswd/awstats/.htpasswd
chown -R $username:$username /home/$username/domains/$domain/.htpasswd/awstats/

mkdir /home/$username/domains/$domain/awstats/
touch /home/$username/domains/$domain/awstats/.htaccess
chown -R $username:$username /home/$username/domains/$domain/awstats/


echo "AuthGroupFile /dev/null" >> /home/$username/domains/$domain/awstats/.htaccess
echo "AuthName \"Member's Area\" " >> /home/$username/domains/$domain/awstats/.htaccess
echo "AuthType Basic" >> /home/$username/domains/$domain/awstats/.htaccess
echo "AuthUserFile /home/$username/domains/$domain/.htpasswd/awstats/.htpasswd" >> /home/$username/domains/$domain/awstats/.htaccess
echo "require valid-user" >> /home/$username/domains/$domain/awstats/.htaccess
ln -s /home/$username/domains/$domain/awstats/ /home/$username/domains/$domain/public_html/stats

exit 0;

--End--
If you have any comments please post it here

I will try to create a script that updates all the current users
 
Last edited:
Back
Top