The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Password protection directory

Discussion in 'Data Protection' started by danrussell, Mar 20, 2015.

  1. danrussell

    danrussell Well-Known Member

    Joined:
    Nov 5, 2014
    Messages:
    60
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hi,

    I want to protect one of folder which is at location httpdocs with password protection
    I have tried the method of password protection using .htpassword option but it wont ask for authentication while accessing the url.
    Can you please let me know what I am doing wrong.

    I have used following method:

    Created .htaccess file under /usr/local/apche/httpdc/Myfolder/ and added following rules into it.


    AuthName " restricted access"
    AuthType Basic
    AuthUserFile /usr/local/apche/httpdoc/Myfolder/.htpasswd

    require user admin



    created user using .htpassword file creator and placed the .htpassword file into other location so that it will not accessible via browser for security purpose.

    Can you please let me know what I am doing wrong.

    Thanks,
    Dan.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,852
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Is this a cPanel server? If so, is there any reason your accounts are not stored in the /home/$username directory? Have you tried using the "Password Protect" feature in cPanel? Or, is this for a system directory that you want accessible to the public?

    Thank you.
     
  3. YogeshP

    YogeshP Registered

    Joined:
    Mar 13, 2015
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    India
    cPanel Access Level:
    Root Administrator
  4. danrussell

    danrussell Well-Known Member

    Joined:
    Nov 5, 2014
    Messages:
    60
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hi :),

    Any suggestions about this case?
    Or need any custom settings for the same?
     
  5. danrussell

    danrussell Well-Known Member

    Joined:
    Nov 5, 2014
    Messages:
    60
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hi ,

    I am able to achieve the password protection by doing slight modification in httpd.conf as below:

    I have created below entry and replaced "AllowOverride None" by "AllowOverride All":
    ===========
    <Directory "/usr/local/apache/htdocs/mrtg">
    Options All
    AllowOverride All
    Require all granted
    </Directory>
    ===========

    Till now no issues with the websites after I restarted the httpd service. Please let me know will it make any other effects with the above changes.

    Regards.
     
    #5 danrussell, Apr 6, 2015
    Last edited: Apr 6, 2015
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,852
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I am happy to see the issue is now resolved. You can find more information on that option at:

    http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

    Thank you.
     
    danrussell likes this.
Loading...

Share This Page