how to lock folders in www based on webmin users

Jeremy Selph's picture

How can I have a password prompt for a specific directory that is based on the users of the webmin panel?

for example in the folder var/www/internal have it so they ahve to login and if the are a user of the webmin and pass is good allow access to directory.

Jeremy Davis's picture


I don't think what you want is possible with Webmin alone. AFAIK you must have root access (or be a sudouser) to use Webmin. There is a module called Usermin that should do what you want. Have a look here:

Jeremy Selph's picture

So after I posted I did more reasearch and made it so when I creat a user from within webmin that I have it also create a user in phpmyadmin. Now unlike the webmin phpmyadmin stores the users and passwords in a sql table.

So after more reasearch I was able to create a php file that using http authentication (password prompt) it pulls the sql users table and logins based on that.

The next issue that I am not sure where to start and I have very little experience, is in locking the actual directory down. I guess this is were htacces files come in but not sure.

Inside of my var/www/ folder I have an internal folder and a projects folder (the webserver is used of testing only, but is avaible to the outside world). If you go to the www folder the password prompt appears and if you have a the correct login and pass you can see the directory (works as wanted). But if you go into www/projects no password prompt. This is what I have to fix now.

If you could jsut tell me in what direction I need to go. That would be great.

I was thinkng if possible, an htacces file in each folder that say if loged in using php $_SESSION['auth'] then continue else go back to main directoy www/. I dont know if this is possible.

What I am trying to do is not hav to put code on every index.php page in every projects folder to make sure the user is logged in. For example www/projects/project1/index.php.

Post new comment