vsftpd Server設定

vsftpd Server 設定

☆說明☆
針對 Redhat、CentOS、Fedora…等的 vsftpd Server 設定。

一.限制用戶只能留在家目錄底下
☆修改☆
指令:vi /etc/vsftpd/vsftpd.conf
修改或加入:
chroot_list_enable = YES(開啟限制功能,並使用 /etc/vsftpd/chroot_list內的用戶進行管制)
chroot_list_file = /etc/vsftpd/chroot_list(將需管理的用戶寫入該檔案,一個用戶一行)
chroot_local_user = YES(限制所有用戶皆不能離開家目錄,但 /etc/vsftpd/chroot_list 內的用戶除外)

二.限制用戶上傳或下載等其它功能
☆修改☆
指令:vi /etc/vsftpd/vsftpd.conf
修改或加入:
user_config_dir = /etc/vsftpd/vsftpd_user_conf(將要管制的用戶依照用戶名稱在此目錄下建立個一檔案,並將設定寫入該檔案內)

如:vi /etc/vsftpd/vsftpd_user_conf/guest(用戶名稱為 guest)

write_enable = YES(寫入狀態 YES/NO)
download_enable = YES(下載狀態 YES/NO)

三.記錄使用者登入時間及資訊
☆修改☆
指令:vi /etc/vsftpd/vsftpd.conf
修改或加入:
vsftpd_log_file = /var/log/vsftpd.log
dual_log_enable = YES
log_ftp_protocol = YES

查看 cat /var/log/vsftpd.log
=========================
Mon Oct 11 05:18:48 2010 [pid 19518] CONNECT: Client “IP位址”
Mon Oct 11 05:18:48 2010 [pid 19518] FTP response: Client “IP位址”, “220 (vsFTPd 2.0.3)”
Mon Oct 11 05:18:50 2010 [pid 19518] FTP command: Client “IP位址”, “USER xxxx
Mon Oct 11 05:18:50 2010 [pid 19518] [xxxx] FTP response: Client “IP位址”, “331 Please specify the password.”
Mon Oct 11 05:18:51 2010 [pid 19518] [xxxx] FTP command: Client “IP位址”, “PASS ”
Mon Oct 11 05:18:52 2010 [pid 19517] [xxxx] OK LOGIN: Client “IP位址”
Mon Oct 11 05:18:52 2010 [pid 19519] [xxxx] FTP response: Client “IP位址”, “230 Login successful.”
=========================

四.範例
anonymous_enable=YES(是否允許 anonymous 登入伺服器,預設為 YES)
local_enable=YES(設定值為 YES 時,在/etc/passwd 內的用戶才能以實體用戶登入伺服器)
write_enable=YES(是否允許寫入,預設為 YES)
local_umask=022
#anon_other_write_enable=YES(是否允許 anonymous 寫入權限,預設為 NO)
#anon_upload_enable=YES(是否允許 anonymous 上傳資料,預設為 NO)
#anon_mkdir_write_enable=YES(是否允許 anonymous 建立目錄,預護為 NO)
dirmessage_enable=YES(?)
xferlog_enable=YES(設定為 YES 時,用戶上傳下載檔案皆會被紀錄起來)
connect_from_port_20=YES(主動式連線使用的 FTP Port)
#chown_uploads=YES(?)
#chown_username=whoever(?)
xferlog_file=/var/log/xferlog(若 xferlog_enables=YES 時,這裡就是紀錄 log 檔的位置)
xferlog_std_format=YES(?)
#idle_session_timeout=600(用戶在 600秒內無回應時即強制離線)
#data_connection_timeout=120(若用戶與伺服器資料連線已成功建立,但在 120秒內無法順利完成傳送時則強制用戶離線)
#nopriv_user=ftpsecure(若入侵僅然取得的用戶權限,可設為 nobody)
#async_abor_enable=YES(?)
#ascii_upload_enable=YES(?)
#ascii_download_enable=YES(?)
#deny_email_enable=YES(禁止 email address 進入,需與下個設定值配合)
#banned_email_file=/etc/vsftpd/banned_emails(在該檔案內可建立 email address 進入伺服器,一行一個 email address)
#chroot_list_enable=YES(是否限制用戶只能在家目錄下,需與下個設定值配合)
#chroot_list_file=/etc/vsftpd/chroot_list(將需管理的用戶寫入該檔案,一個用戶一行)
#ls_recurse_enable=YES(?)
listen=YES(若為 YES 時,伺服器是以 standalone 方式啟動,預設為 YES)
#listen_ipv6=YES(?)

chroot_list_enable=YES(是否限制用戶只能在家目錄下,需與下個設定值配合)
chroot_list_file=/etc/vsftpd/chroot_list(將需管理的用戶寫入該檔案,一個用戶一行)
chroot_local_user=YES(限制所有用戶皆不能離開家目錄,但 /etc/vsftpd/chroot_list 內的用戶除外)

pam_service_name=vsftpd(?)
userlist_enable=YES(是否限制部份用戶)
tcp_wrappers=YES(是否支援 TCP Wrappers)

vsftpd_log_file=/var/log/vsftpd.log(伺服器紀錄檔)
dual_log_enable=YES(?)
log_ftp_protocol=YES(?)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *