TurnKey Linux Virtual Appliance Library

how to lock folders in www based on webmin users

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's picture

You want Usermin

Hi,

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: http://www.webmin.com/usermin.html

I think i figured out a way but still have one issue

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

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)