カスタム検索
|
Tweet |
|
|
wu-ftpd (FTPサーバ) の小技
Modified: 23 Jun 2001
Redhat Linux 7.1で使えるかどうかは実験中です。
順次、Redhat Linux 7.1 でも使えるかどうか、また、Redhat Linux 7.1 での小技を追加していきます。
ログインディレクトリを仮想ルートにする方法 (2 Jun 2001)
FTPログインできないユーザを登録したい
サービスを許可するホストを特定したい
anonymous FTPを禁止する方法
ftpでログインしている人を見る方法
Anonymousログインの記録を見る
anonymous のみのサーバーにする方法
家庭内のみログインを有効にする方法
ログインディレクトリを仮想ルートにする方法
FTPでログインすると、そこからディレクトリをさかのぼって、他のユーザのファイルをのぞくことが出来ます。
特別な設定をすると、ログインしたディレクトリの上位のディレクトリには移れないように設定できます。
"/etc/ftpaccess"に、グループを追加
"/etc/ftpaccess"の最後の行として、以下を追加します。
guestgroup ftpolny
"/etc/group"に、"ftpolny"を追加する
"/etc/group"に、"ftpolny"を追加します。
# groupadd ftponly
"ftponly"グループのユーザを作る
以下のように、ftponly に所属するグループとして、ユーザ(以下の例では、"tomo")を作成します。
# useradd -g ftponly -G ftponly -d /home/tomo tomo
パスワードの設定
# passwd tomo
tomoでログインすると、そのディレクトリより上位のディレクトリには移動できなくなります。
FTPログインできないユーザを登録したい
/etc/ftpusers に、拒否したいユーザ名を書けば、FTPログインできなくなります。
root でログインできないのは、ここに、root が記載されているからです。
以下は、Redhat6.2 の情報です。Redhat7.1 では、inetd から Xinetd に代わり、設定方法が大きく変わりました。
ftpサービスは、inetdとTCPWrappersで起動します。
この、「inetd (TCP Wrappers) を設定してみる」で、サービスを制限する方法を紹介しています。
"/etc/ftpaccess"の設定を変更します。
デフォルトでは、以下のように、ログインできます。
C:\WINDOWS>ftp linuxserver
Connected to linuxserver.tomo.lint.ne.jp.
220 linuxserver FTP server (Version wu-2.6.0(1) Mon Feb 28 10:30:36 EST 2000) re
ady.
User (linuxserver.tomo.lint.ne.jp:(none)): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password: xxx@xxx.xxx
230 Guest login ok, access restrictions apply.
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 16
d--x--x--x 2 root root 4096 Aug 13 16:10 bin
d--x--x--x 2 root root 4096 Aug 13 16:10 etc
drwxr-xr-x 2 root root 4096 Aug 13 16:10 lib
drwxr-sr-x 2 root ftp 4096 Feb 4 2000 pub
226 Transfer complete.
ftp: 250 bytes received in 0.44Seconds 0.57Kbytes/sec.
ftp>インストール後cは、以下のようになっています。
class all real,guest,anonymous * 以下のように、"anonymous" を削除すると、禁止できます。
class all real,guest *
インストール後"/etc/ftpaccess"は、以下のようになっています。
class all real,guest,anonymous * 以下のように、"anonymous" を削除すると、禁止できます。
class anonclass anonymous *
インストール後"/etc/ftpaccess"は、以下のようになっています。
class all real,guest,anonymous * 以下のように、"anonymous" を削除すると、禁止できます。
class locanlan real 192.168.0. *
# ftpwho
Service class all:
23029 ? S 0:00 ftpd: p63600e.tomo.lint.ne.jp: anonymous/tomo@tomo.ac
- 1 users (no maximum)
#
"/var/log/message" に記録されています。
ユーザー(tomo)やパスワード(tomo@tomo.ac)も記録されています。
:
Sep 3 11:03:17 linuxserver ftpd[23027]: FTP LOGIN FROM p63600e.tomo.lint.ne.jp [192.168.0.9], tomo
Sep 3 11:03:22 linuxserver ftpd[23027]: FTP session closed
Sep 3 02:03:47 linuxserver ftpd[23029]: ANONYMOUS FTP LOGIN FROM p63600e.tomo.lint.ne.jp [192.168.0.9], tomo@tomo.ac
:
転送バイト数は、"/var/log/xferlog" に記録されているそうです。
ログインできるがコマンドが使えない
エラーを調べたら、
/etc/ftpusers が見つからない
という理由で、拒否されていました。
/etc/ftpusers に、以下の記述をしたらうまくいくようになりました。
root
uucp
news
この /etc/ftpusers には、FTPアクセスを拒否するユーザー名を書くそうです。