Turbo Linux 7 Server - ProFTPD, Samba

Last Modified: 2002.02.15

12. ProFTPDの設定
以下を基本方針とする。
  • Anonymous FTPとして、/home/ftpを公開する。
  • アカウントを持っているユーザは、そのユーザでログインして/home/ftpに書き込みが可能。
  • 例えアカウントを持っていても(アカウントがばれても)、/home/ftp以下にしかアクセスできない。
  • FTPは利用頻度が少ないので、xinetdからの起動とする。
  • パソコンおやじさんのFTPサーバの公開を参考に、Passiveモードに対応しました(2002-10-05)。

1. /home/ftpを作成


 [root@linux /root]# mkdir /home/ftp
 [root@linux /root]# chown ftp /home/ftp
 [root@linux /root]# chgrp ftp /home/ftp
 [root@linux /root]# chmod 777 /home/ftp

2. /etc/proftpd/proftpd.confを編集


 ServerName             "ftp.kkoba.com"   <-- 名称
 ServerType             inetd             <-- Standaloneから変更。inetdからの起動にする。
 DefaultRoot            /home/ftp         <-- /home/ftpが常にftp時の/となるようにする。
 IdentLookups           off               <-- Identを無効にする。
 MasqueradeAddress      kkoba.dns2go.com  <-- FTP PassiveコマンドのIPアドレスをグローバルIPにマスカレード。
 PassivePorts           4000 4029         <-- Passive用のポートを4000-4029に限定。


 <Anonymous /home/ftp>                    <-- ~ftpから/home/ftpに変更
     RequireValidShell    off             <-- コメントを外す。(Anonymous FTP公開のため)
上記は変更した部分のみ。
Passiveモードを利用するための理屈と詳細は、パソコンおやじさんのFTPサーバの公開を参照。

3. /etc/xinetd.d/ftpを作成


 service ftp
 {
         disable         = no
         socket_type     = stream
         protocol        = tcp
         wait            = no
         user            = root
         server          = /usr/sbin/in.proftpd
 }
標準では/etc/xinetd.d/ftpは存在しないので、自分で作成する。

4. xinetdを再起動して変更を有効にする


 [root@linux /root]# /etc/init.d/xinetd restart


13. Sambaの設定
以下を基本方針とする。
  • セキュリティーはuser(ユーザ名とパスワードで制御)とする。
  • /home/ftpと、自分のホームディレクトリにアクセス可能とする。
  • 当然外部からのアクセスは許さない。
  • Sambaは利用頻度が少ないので、xinetdからの起動とする。

1. /etc/smb.confを編集


 [global]
     workgroup           = kkoba               <-- Windowsのワークグループ名を指定。
     coding system       = EUC                 <-- ServerのコードはEUC。
     client code page    = 932                 <-- Clientの文字は日本語Shift JIS。
     security            = user                <-- パスワードとユーザ名でアクセス制御
     load printers       = no                  <-- プリンタはない。
     encrypt passwords   = yes                 <-- 暗号化パスワードを利用
     smb passwd file     = /etc/smbpasswd      <-- パスワードファイル
     map to guest        = Bad User            <-- ユーザ名が存在しないときはGuest
     guest account       = ftp                 <-- guest accountはftp

 [homes]
    comment              = Home Directories
    browseable           = no
    writable             = yes
 
 [ftp]
    comment              = Anonymous FTP
    path                 = /home/ftp
    public               = yes
    writable             = yes
    force group          = ftp
    force create mode    = 0664
    force directory mode = 0775
上記は変更した部分のみ。
[ftp]セクションは、[public]セクションのセクション名を変更して利用。
その他のセクションは全てコメント化。

2. Samba用パスワードの設定


 [root@linux /root]# touch /etc/smbpasswd
 [root@linux /root]# chmod 600 /etc/smbpasswd
 [root@linux /root]# smbpasswd -a ユーザ名     <-- ユーザのsmb用パスワードの追加

3. /etc/xinetd.d/netbios-nsファイルを作成


 service netbios-ns
 {
         disable         = no
         socket_type     = dgram
         protocol        = udp
         wait            = yes
         user            = root
         server          = /usr/sbin/nmbd
         only_from       = 172.25.0.0/24
 }
/etc/xinetd.d/netbios-nsファイルは標準では存在しないので、自分で作成する。
172.25.0.xからのアクセスのみ許可。

4. /etc/xinetd.d/netbios-ssnファイルを作成


 service netbios-ssn
 {
         disable         = no
         socket_type     = stream
         protocol        = tcp
         wait            = no
         user            = root
         server          = /usr/sbin/smbd
         only_from       = 172.25.0.0/24
 }
/etc/xinetd.d/netbios-ssnファイルは標準では存在しないので、自分で作成する。
172.25.0.xからのアクセスのみ許可。

5. xinetdを再起動して変更を有効にする


 [root@linux /root]# /etc/init.d/xinetd restart

以上の設定を行うと、Windows2000からは以下のように見える。
"linux"と言う名前で、TurboLinux 7 Serverマシンが見える。
"ftp"と"ユーザ名"と言うフォルダが見える。
"ftp"フォルダはそのままアクセス可能。

"ユーザ名"フォルダはアクセスするにはユーザ名とパスワードが必要。
ただし、Windowsのログイン名とパスワードがsmbpasswdの設定と同じ場合は、
ユーザ名もパスワードも不要。

<Prev Top Next>
Copyright(C) 2001-2009 Katsuyuki Kobayashi.
このサイトへのリンクや引用時はメール頂戴
webmaster@kkoba.com