How to make a file for authentication from an apache server
Suggestion: It maybe better to print the instructions before starting to have them always next to you.

  1. Create a directory .wwwpasswd away from the web tree (not visible from a browser).
  2. Create a file .htaccess with your favourite editor inside the directory that you want to lock that include the following:


    	AuthUserFile /home/your_home_dir/.wwwpasswd/.htpasswd
    	AuthGroupFile /dev/null
    	AuthName ByPassword
    	AuthType Basic
    
    	<Limit GET>
    	require user user1
    	require user user2
    	...
    	</Limit>	
    	

  3. Change the path of AuthUserFile to correspond to the path where your .wwwpasswd is (Absolute path and NOT relative).
  4. Change the line "require user ..." to "require user <login>" where you replace <login> with the login name you want to create. You can copy this line and paste as many times as the number of users that you want to authenticate.
  5. Save the file .htaccess
  6. Make the file .htaccess write-protected by giving the following command from a terminal:
    >chmod go-w .htaccess
  7. Open a terminal (Telnet) from Windows or Xterm from Unix/Linux
  8. Give passwords to the users that you have declared inside the .htaccess by giving the following command from your terminal (Telnet):
    >htpasswd -c </home/your_home_dir/.wwwpasswd/>.htpasswd <login>
    for the first user and
    >htpasswd </home/your_home_dir/.wwwpasswd/>.htpasswd <login>
    for the rest users.
  9. Test your web page to see if everything works as it should be (page locked under the password that you defined)
  10. If it works, it's your lucky day :) otherwise go over again the whole procedure to see if you haven't forgotten something
DISCLAIMER: I am not an expert, I do that very rare for some students or colleagues that ask for my help :) but most of the times it works...