Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Password protection directory

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

  1. danrussell

    danrussell Well-Known Member

    Joined:
    Nov 5, 2014
    Messages:
    61
    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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,704
    Likes Received:
    1,883
    Trophy Points:
    363
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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:
    61
    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:
    61
    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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,704
    Likes Received:
    1,883
    Trophy Points:
    363
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    danrussell likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice