はじめての自宅サーバ構築 - Fedora/CentOS - Last Update 2008/07/25
It opened to 2004/09/19.
当サイトはFedora9で運用しています
Visitors
Pageviews
Today(IP/PV)
3,374,115
12,762,050
1,273/8,672

■ TIPS集『FTPサーバ(vsFTPD)』

 一般ユーザをホームディレクトリ以外に移動させなくさせるには?(chroot)

通常(制限をかけていない場合)
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Fedora>ftp
ftp> op
To 192.168.1.5
Connected to 192.168.1.5.
220 (vsFTPd 2.0.3)
User (192.168.1.5:(none)): linux
331 Please specify the password.
Password:
230 Login successful.
現在のパス表示
ftp> pwd
257 "/home/linux"
「/etc」に移動
ftp> cd /etc
ディレクトリ移動成功
250 Directory successfully changed.
現在のパス表示
ftp> pwd
「/etc」に移動している
257 "/etc"
ftp> bye
221 Goodbye.


vsftp設定ファイル変更
# vi /etc/vsftpd/vsftpd.conf
# 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を有効にする
chroot_list_enable=YES
# (default follows)
"#"を削除し、chrootを有効にするユーザリストファイル指定
chroot_list_file=/etc/vsftpd/chroot_list


chrootユーザリストファイルに制限させるユーザを追加(複数ユーザの場合は次の行に追加する)
# vi /etc/vsftpd/chroot_list
linux


vsftpサービスを再起動する
# /etc/rc.d/init.d/vsftpd restart


chrootが有効になっているか確認
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Fedora>ftp
ftp> op
To 192.168.1.5
Connected to 192.168.1.5.
220 (vsFTPd 2.0.3)
User (192.168.1.5:(none)): linux
331 Please specify the password.
Password:
230 Login successful.
現在のパス表示
ftp> pwd
257 "/"
「/etc」に移動
ftp> cd /etc
ディレクトリ移動失敗(chrootが機能している)
550 Failed to change directory.
ftp> bye
221 Goodbye.
ページ先頭へ

Copyright(©)2004-2008 First home server construction. All Right Reserved.