Home
BSD Applications
Apache WebServer
Authentication
BSD Applications
Apache WebServer
Authentication | Authentication |
|
|
|
This section helps you to setup Apache to require authentication for accessing a certain resource from your webserver. To do this you need to do some modifications in httpd.conf file, or if you are not allowed, in a .httaccess file which you place in the directory that you want to protect. If you have access to httpd.conf file, you should place the following lines into Directory tag for your location: <Directory "/path/to/your/directory"> AuthType Basic AuthName "Restricted Files" AuthUserFile /path/to/your/directory/.htpasswd Require valid-user </Directory> and after that restart httpd server. If you cannot access httpd.conf file you should place a file named .htaccess in the root of your directory that you want to protect containing th e followings: AuthType Basic AuthName "Restricted Files" AuthUserFile /path/to/your/directory/.htpasswd Require valid-user For this to take effect, httpd.conf file must contain the following into Directory tag for your location: <Directory "/path/to/your/directory"> AllowOverride AuthConfig </Directory> To generate the .htpasswd file, run: htpasswd -c /path/to/your/directory/.htpasswd user where user is the user that you want to have access to that directory. You will be asked for password and the .htpasswd file will be generated. |



