![]() |
| ◆ | 注意 |
| ここでの内容は、コンソールモード時の文字化け対策 で紹介した bterm を起動した状態での内容です。bterm を起動しない状態でも内容は同じですが一部日本語表記が文字化けする場合があります。 | |
| ◆ | vsftpd のインストール |
|
Fedora Core 4 のインストール時 “FTPサーバ” を選択していれば vsftpd はインストールされています。 もし、Fedora Core 4 のインストール時 “FTPサーバ” を選択していない場合は下記要領でインストールして下さい。 下記のように入力します。 |
|
|
user@linux]$ su
← ユーザーでログインしている場合は root に移行 password : ****** ← root のパスワード入力(* は実際には表示されません) [root@linux]# yum install vsftpd ← yum inatall vsftpd を入力 Setting up Install Process ↓↓ ↓↓ 途中省略 ↓↓ Total download size: 123 K Is this ok [y/n]: y ← y を入力 Downloading Packages: ↓↓ ↓↓ 途中省略 ↓↓ Dependency Installed: vsftpd.l386 0:2.0.3-1 Complete! ← Complete! と表示されれば完了 [root@linux]# |
|
| ◆ | FTPソフト vsftpd の設定 |
|
RedHat-8以降で標準の vsftpd を使う場合、初期設定の問題から,ASCIIモードで転送したつもりでも,バイナリモードで転送されてしまいます。 バイナリモードで転送された場合 html ファイルは問題無いのですが CGI ファイル (.cgi .pl 等) は正常に動作しません。これでは掲示板やアクセスカウンターが利用できないので設定をします。 下記のように入力します。vsftpd の設定ファイル が表示されます。 |
|
| [root@linux]# vi /etc/vsftpd/vsftpd.conf | |
| 下記のように緑色の部分を黄色に変更(書き換え・削除)して下さい。赤文字は説明です。 | |
|
# The default comilde in settings sre
fairly paranoid. This sample file ↓↓ ↓↓ 途中省略 ↓↓ # ascii_upload_enable=YES ↓ ascii_upload_enable=YES ← # を消して有効にする # ascii_download_enable=YES ↓ ascii_download_enable=YES ← # を消して有効にする ↓↓ ↓↓ 途中省略 ↓↓ tcp_wrappers=YES |
|
|
基本的には上記のような設定で問題なく動作します。また、この場合のFTPサーバーへのログイン方法はLinuxにログインしているユーザー名とパスワードでログインできます。 尚、もう少し高度の設定を下記に紹介しますのでお好みに合わせて設定して下さい。 |
|
|
# The default comilde in settings sre
fairly paranoid. This sample file ↓↓ ↓↓ 途中省略 ↓↓ # Allow anonymous FTP? (Beware - allowed by default if you comment this out). anonymous_enable=YES ↓ anonymous_enable=NO ← anonymous(匿名ユーザー)のログインを許可しない ↓↓ ↓↓ 途中省略 ↓↓ # You may fully customise the login banner string: # ftpd_banner=Welcome to blah FTP service. ↓ ftpd_banner=unknown ← ログイン時にソフト名とバージョンが表示されないようにする ↓↓ ↓↓ 途中省略 ↓↓ # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # chroot_list_enable=YES ↓ chroot_list_enable=YES ← ホームディレクトリより上層へのアクセスを許可するユーザリストの有効 chroot_local_user=YES ← ホームディレクトリより上層へのアクセスを許可しない(追記) # (default follows) # chroot_list_file=/etc/vsftpd/chroot_list ↓ chroot_list_file=/etc/vsftpd/chroot_list ← ホームディレクトリより上層へのアクセスを許可するユーザリスト ↓↓ ↓↓ 途中省略 ↓↓ # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. # ls_recurse_enable=YES ↓ ls_recurse_enable=YES ← ディレクトリごと削除できるようにする ↓↓ ↓↓ 途中省略 ↓↓ tcp_wrappers=YES ← ファイルの最終行 ssl_enable=YES ← SSL接続をする場合に追記 |
|
| ホームディレクトリより上層へのアクセスを許可するユーザリストの作成。下記のように入力します。 | |
| [root@linux]# echo **** >> /etc/vsftpd/chroot_list ← **** をホームディレクトリより上層へのアクセスを許可する | |
| ◆ | FTPサーバの開始 |
| 下記のように入力します。 | |
|
[root@linux]# /etc/rc.d/init.d/vsftpd start
← /etc/rc.d/init.d/vsftpd start
を入力(vsftpd の起動) vsftpd 用の vsftpd を起動中: [ OK ] |
|
| 続いてPCの再起動に vsftpd を自動的に起動するようにします。下記のように入力します。 | |
| [root@fedora ~]# chkconfig vsftpd on ← chkconfig vsftpd on を入力(vsftpd の自動起動) | |
| 自動起動設定の確認。下記のように入力し 、下記のように表示されればOKです。 | |
|
[root@linux]# chkconfig --list vsftpd
← chkconfig --list vsftpd
を入力(vsftpd の自動起動確認) httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
|
| 再起動は下記のように入力します。 | |
| [root@linux]# /etc/rc.d/init.d/vsftpd restart | |
| ◆ | ポートの開放 |
| Webサーバー用のポート 21 を開放します。 下記のように入力します。 |
|
| [root@linux]# vi /etc/sysconfig/iptables ← vi /etc/sysconfig/iptables を入力(設定ファイル iptables を開く) | |
| 設定ファイル iptables が開きますので最終行に -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT を追記してポート番号 21 を開きます。 | |
|
# Firewall configuration written by system-config-securitylevel # Manual customization of this file is recommended. *filter :IMPUT ACCEPT [0:0] ↓↓ ↓↓ 途中省略 ↓↓ -A INPUT -j RH-Firewall-1-INPUT ↓↓ ↓↓ 途中省略 ↓↓ -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT ← 最終行に追記 |
|
| 設定を反映させるため iptables を再起動させます。 | |
|
[root@papa-net ~]# /etc/rc.d/init.d/iptables restart ← /etc/rc.d/init.d/iptables iptables を入力 ファイアウォールルールを適用中: [ OK ] チェインポリシーを ACCEPT に設定中filter [ OK ] iptables モジュールを取り外し中 [ OK ] iptables ファイアウォールルールを適用中: [ OK ] iptables モジュールを読み込み中ip_conntrack_netbios_ns [ OK ] |
|