# mkdir /var/www/html/staff # cd /var/www/html/staff # htpasswd -c .htpasswd staff New password: ***** Re-type new password: ***** Adding password for user staff [root@h030 staff]# ls -l .htpasswd -rw-r--r-- 1 root root 20 12月 26 14:26 .htpasswd [root@h030 staff]# cat index.html <!-- vi などを使い新規作成する --> <html> <head> <title>Staff top</title> </haed> <body> <h1>Welcome staff area</h1> </body> </html>
# <directory>ディレクティブ群の最後追加 ## ycos 2010/12/19 ++++ <Directory "/var/www/html/staff"> AuthType Basic AuthName "Staff only" AuthUserFile /var/www/html/staff/.htpasswd Require user staff <Directory> ## ycos 2010/12/19 ---- |
#! /bin/bash cat <<EOD Content-type: text/plain `env` EOD |
# <IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # # このエントリをコメントアウト # UserDir disable # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disable" line above, and uncomment # the following line instead: # # ここを有効化 UserDir public_html </IfModule> |
$ ls -ld ~ drwx--x--x 23 student student 1024 12月 26 14:25 /home/student $ ls -ld ~/public_html/ drwxrwxr-x 2 student student 1024 12月 19 16:26 /home/student/public_html/