how to pwd protect directories with when using no control panel, I am planning to change the login details of the protected directories every few days as well as its top secret data, so I would like to know how to protect directories with pwd, I know how to do using control panel such as cPanel r Plesk but I am having no control panel at this interface
I intend to share the files under this protected directories only to my team, so plz help me with codes if there are any
you will have to modify the above according to your situation. In particular, change:
Change "Secure Area" to any name that you like. This name will be displayed when the browser prompts for a password. If, for example, that area is to be accessible only to members of your site, you can name it "Members Only" or the like.
You will create a file containing passwords named .htpasswd later. The "AuthUserFile" line tells the Apache web server where it can locate this password file.
Ideally, the password file should be placed outside any directory accessible by visitors to your website. In that case there are no chances that your visitors can view the .htpasswd contents by simply typing http://www.example.com/.htpasswd.
Wherever you decide to place the file, put the full path of that file after "AuthUserFile". For example, if the directory where you placed the file is /home/your-account-name/.htpasswd, modify that name to "AuthUserFile /home/your-account-name/.htpasswd". Note that your password file need not be named .htpasswd either. It can be any name you wish. For ease of reference, however, this tutorial will assume that you chose ".htpasswd".
Set Up the Password File, .htpasswd
htpasswd -c .htpasswd your-user-name
where your-user-name is the login name of the user you want to give access.
The user name should be a single word without any intervening spaces. You will then be prompted to enter the password for that user. When this is done, the htpasswd utility creates a file called .htpasswd in your current directory (home directory). You can move the file to its final location later, according to where you set the AuthUserFile location in .htaccess.
If you have more than one users, you should create passwords for them as well, but using the following command for each subsequent user:
htpasswd .htpasswd another-user-name
If you are curious about the contents of the file, you can take a look using the following command:
Since the .htpasswd file is a plain text file, with a series of user name and encrypted password pairs, you might see something like the following:
you should make sure that permissions on the file are acceptable (644 or 755)
In any case, the passwords are encrypted, so a cursory glance at the file will hopefully not give away the passwords.
Remember that your file does not even have to be called .htpasswd. You can name it anything you like. However, if you do, make sure that your AuthUserFile has the same directory and filename or Apache will not be able to locate it