{"id":50420,"date":"2026-11-20T05:24:09","date_gmt":"2026-11-20T05:24:09","guid":{"rendered":"https:\/\/kickhost.com\/guides\/how-to-password-protect-a-directory-in-cpanel\/"},"modified":"2026-11-28T09:21:10","modified_gmt":"2026-11-28T09:21:10","slug":"how-to-password-protect-a-directory-in-cpanel","status":"publish","type":"kickhost_tutorial","link":"https:\/\/kickhost.com\/en-ke\/guides\/how-to-password-protect-a-directory-in-cpanel\/","title":{"rendered":"How to Password Protect a Directory in cPanel"},"content":{"rendered":"<p>You can lock a folder so visitors must enter a username and password. It is useful for staging sites, private files or admin tools.<\/p>\n<p>You can lock a directory with a password using the cPanel&#8217;s <strong>Directory Privacy<\/strong>.<\/p>\n<p><strong>1.<\/strong> Log in to your cPanel account.<\/p>\n<p><strong>2.<\/strong> In the <strong>Files<\/strong> section, click on <strong>Directory Privacy<\/strong>.<br \/> <img decoding=\"async\" src=\"https:\/\/kickhost.com\/img\/password-protected-directories.gif\" alt=\"\" align=\"middle\" loading=\"lazy\"><\/p>\n<p><strong>3.<\/strong> Click on the directory to open it.<br \/><img decoding=\"async\" src=\"https:\/\/kickhost.com\/img\/paper-folder-icon-passprotect.gif\" alt=\"\" align=\"middle\" loading=\"lazy\"><\/p>\n<p><strong>4.<\/strong> Click on the <strong>Edit<\/strong>, showing next to the directory you want to protect.<br \/><img decoding=\"async\" src=\"https:\/\/kickhost.com\/img\/pass-pro.gif\" alt=\"\" loading=\"lazy\"><\/p>\n<p><strong>5.<\/strong> Under <strong>Security Settings<\/strong>, check-mark <strong>Password protect this directory<\/strong>. Then click on <strong>Save<\/strong>.<br \/><img decoding=\"async\" src=\"https:\/\/kickhost.com\/img\/password-settings.gif\" alt=\"\" loading=\"lazy\"><\/p>\n<p><strong>6.<\/strong> Now click on <strong>Go back<\/strong>.<br \/><img decoding=\"async\" src=\"https:\/\/kickhost.com\/img\/goback.gif\" alt=\"\" loading=\"lazy\"><\/p>\n<p><strong>7.<\/strong> Scroll down the page. Under <strong>Create User<\/strong>, fill in the username and password fields or use the Password Generator option to generate a new random password and copy it to Notepad. Click on <strong>Save<\/strong>.<br \/><img decoding=\"async\" src=\"https:\/\/kickhost.com\/img\/password-pro-user-gen.gif\" alt=\"\" loading=\"lazy\"><\/p>\n<p>If you try to open the password-protected directory in your browser via the URL www.example.com\/myfolder, your browser prompts for credentials.<br \/><img decoding=\"async\" src=\"https:\/\/kickhost.com\/img\/prompted-for-login.gif\" alt=\"\" loading=\"lazy\"><\/p>\n<h2>Create a user<\/h2>\n<p>After you protect the folder, create at least one user with a strong password. Share those details only with trusted people.<\/p>\n<h2>Do not lock the wrong folder<\/h2>\n<p>Protecting public_html asks every visitor for a password. Choose the specific folder you want to hide.<\/p>\n<h2>Frequently asked questions<\/h2>\n<p><strong>Does it stop search engines?<\/strong> Yes. Search engines cannot open a password protected folder.<\/p>\n<p><strong>How do I remove the protection?<\/strong> Open the same page and untick the protect option.<\/p>\n<h2>Related guides<\/h2>\n<ul>\n<li><a href=\"https:\/\/kickhost.com\/en-ke\/guides\/how-to-restrict-access-to-directories-by-ip-address\/\">Restrict a directory by IP address<\/a><\/li>\n<li><a href=\"https:\/\/kickhost.com\/en-ke\/guides\/how-to-edit-dothtaccess-file-in-the-cpanel-file-manager\/\">Edit the .htaccess file<\/a><\/li>\n<\/ul>\n<p>Need cPanel hosting in Kenya? <a href=\"https:\/\/kickhost.com\/en-ke\/web-hosting\/\">See KickHost hosting plans<\/a> or <a href=\"https:\/\/kickhost.com\/en-ke\/contact\/\">contact our team<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Password protect a directory in cPanel with Directory Privacy. Steps for KickHost customers in Kenya.<\/p>\n","protected":false},"featured_media":0,"template":"","class_list":["post-50420","kickhost_tutorial","type-kickhost_tutorial","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial\/50420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial"}],"about":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/types\/kickhost_tutorial"}],"version-history":[{"count":3,"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial\/50420\/revisions"}],"predecessor-version":[{"id":53427,"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/kickhost_tutorial\/50420\/revisions\/53427"}],"wp:attachment":[{"href":"https:\/\/kickhost.com\/en-ke\/wp-json\/wp\/v2\/media?parent=50420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}