トップ 一覧 ping 検索 ヘルプ RSS ログイン

Linux ユーザホームページ作成の変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!!!Linux ユーザホームページ作成

::ユーザを作成し、公開ディレクトリを作成
*[username]にユーザ名を指定

 useradd [username]
 passwd [password]

 chmod -R 711 /home/[username]
 cd /home/[username]
 mkdir public_html
 vi index.html
 chmod 644 index.html
  
::apache httpdの設定を変更
http://httpd.apache.org/docs/2.2/ja/mod/mod_userdir.html
 <IfModule mod_userdir.c>
    UserDir disable
    UserDir enabled [username]
    UserDir enabled [username] [username2] ... 
       
    UserDir public_html  <-- コメント解除
 </IfModule>

↓コメント解除
 <Directory /home/*/public_html>
     AllowOverride FileInfo AuthConfig Limit
     Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
     Options +ExecCGI                    <-- CGI使用時追加
     AddHandler cgi-script .cgi .pl      <-- CGI使用時追加
     <Limit GET POST OPTIONS>        Order allow,deny
         Allow from all
     </Limit>
     <LimitExcept GET POST OPTIONS>
         Order deny,allow
         Deny from all
     </LimitExcept>
 </Directory>

::Basic認証
必要があればBasic認証を行う
*apache httpdの設定に追記
 <Directory "/home/[username]/public_html">
     AuthType Basic
     AuthName "Restricted Files"
     AuthUserFile /home/[username]/shadow
     Require valid-user
     Options Indexes Multiviews
     AllowOverride None
     Order allow,deny
     Allow from all
 </Directory>
+/etc/shadow ファイルを、/home/[username]/shadow にコピーしてくる。
+許可するユーザの行を残し、他を削除し保存する

::アクセス

 http://[ホスト名]/~[username]

にてアクセスする。