\documentclass{cmlab} \RCS $Revision: 1.5 $ \usepackage{nick,mdwlist,alltt,url,rcs} \ifx\pdftexversion\undefined \else \usepackage[pdfpagemode=UseNone,pdfauthor={Nick Urbanik}]{hyperref} \fi \newcommand*{\labTitle}{How to create a password protected directory on a web server} \begin{document} How to do it: \begin{thinEnumerate} \item Edit the web server configuration file \url{/etc/httpd/conf/httpd.conf} (in emacs, select \textsf{Files$\to$Open~File}). \item Add the following to the end of the web server configuration file: \begin{alltt} AuthType Basic AuthName "Web Administrator" AuthUserFile /etc/httpd/conf/passwd require valid-user \end{alltt} \item Create the password file by: \begin{thinEnumerate} \item \texttt{cd /etc/httpd/conf} \item \texttt{sudo htpasswd -m -c passwd \emph{username}} \end{thinEnumerate} \item Add more users to the password file with \texttt{sudo htpasswd -m passwd \emph{other-username}} \item Check the syntax of the configuration file with: \texttt{httpd -t} You should see ``Syntax OK''. If not, check your editing of the web server configuration file. \item Restart the server with \texttt{sudo /etc/rc.d/init.d/httpd restart} \item Create a secret directory with \begin{alltt} cd /var/www/html sudo mkdir secret \end{alltt} Now copy a secret html file into that directory. Call it \texttt{index.html} \item Type in the URL of your own computer, or use its ``loopback'' address: \url{http://localhost/secret/} \item If no success, do this: \texttt{tail -f /var/log/httpd/error\_log} \item Now do the same again with a different directory, using \emph{digest authentication}. Read the documentation for Apache, which is available online on your computer at: \url{http://localhost/manual/}. To look up information about digest authentication, you can go to the link to \texttt{Modules:~By~Type} from that page, then go to \emph{Access Control}, then select the module \texttt{mod\_digest}. You will need to enable the \texttt{mod\_digest} Apache module by uncommenting the lines: \begin{verbatim} LoadModule digest_module modules/mod_digest.so \end{verbatim} and \begin{verbatim} AddModule mod_digest.c \end{verbatim} in \texttt{/etc/httpd/conf/httpd.conf}, then restart Apache. Demonstate to your tutor. \end{thinEnumerate} \end{document}