?
vsftpd?作為一個主打安全的FTP服務器,有很多的選項設置。下面介紹了vsftpd的配置文件列表,而所有的配置都是基于vsftpd.conf這個配置文件?的。本文將提供完整的vsftpd.conf的中文說明。學習本文的內容將有助于你初步了解vsftpd的配置文件,但針對具體情況還需要制定具體的配置?方法。
Vsftpd的配置文件:?
/etc/vsftpd/vsftpd.conf | 主配置文件 |
/usr/sbin/vsftpd | Vsftpd?的主程序 |
/etc/rc.d/init.d/vsftpd | 啟動腳本 |
/etc/pam.d/vsftpd | PAM?認證文件(此文件中file=/etc/vsftpd/ftpusers字段,指明阻止訪問的用戶來自/etc/vsftpd/ftpusers文件中的用戶) |
/etc/vsftpd/ftpusers | 禁止使用vsftpd?的用戶列表文件。記錄不允許訪問FTP服務器的用戶名單,管理員可以把一些對系統安全有威脅的用戶賬號記錄在此文件中,以免用戶從FTP登錄后獲得大于上傳下載操作的權利,而對系統造成損壞。(注意:?linux-4?中此文件在?/etc/?目錄下) |
/etc/vsftpd/user_list | 禁止或允許使用vsftpd?的用戶列表文件。這個文件中指定的用戶缺省情況(即在/etc/vsftpd/vsftpd.conf?中設置userlist_deny=YES?)下也不能訪問FTP服務器,在設置了userlist_deny=NO?時,僅允許user_list?中指定的用戶訪問FTP?服務器。(注意:?linux-4?中此文件在?/etc/?目錄下) |
/var/ftp | 匿名用戶主目錄;本地用戶主目錄為:/home/?用戶主目錄?,即登錄后進入自己家目錄 |
/var/ftp/pub | 匿名用戶的下載目錄,此目錄需賦權根chmod 1777 pub?(1?為特殊權限,使上載后無法刪除) |
/etc/logrotate.d/vsftpd.log | Vsftpd?的日志文件 |
vsftpd?的主配置文件/etc/vsftpd/vsftpd.conf?說明(?修改前先備份)?:?
# Example config file /etc/vsftpd/vsftpd.conf?
# The default compiled in settings are fairly paranoid. This sample file?
# loosens things up a bit, to make the ftp daemon more usable.?
# Please see vsftpd.conf.5 for all compiled in defaults.?
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.?
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's?
# capabilities.?
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).?
anonymous_enable=YES?(?是否允許?匿名登錄FTP服務器,默認設置為YES允許,即用戶可使用用戶名ftp或anonymous進行ftp登錄,口令為用戶的E-mail地址。如不允許匿名訪問去掉前面#并設置為NO?)?
# Uncomment this to allow local users to log in.?
local_enable=YES?(是否允許本地用戶?(?即?linux?系統中的用戶帳號)?登錄FTP服務器,默認設置為YES允許,?本地用戶登錄后會進入用戶主目錄,而匿名用戶登錄后進入匿名用戶的下載目錄/var/ftp/pub?;若只允許匿名用戶訪問,前面加上#,可?阻止本地用戶訪問FTP服務器。)?
# Uncomment this to enable any form of FTP write command.?
write_enable=YES???(?是否允許本地用戶對?FTP?服務器文件具有寫權限?,?默認設置為?YES?允許?)?
# Default umask for local users is 077. You may wish to change this to 022,?
# if your users expect that (022 is used by most other ftpd's)?
#?local_umask=022?(或其它值,設置本地用戶的文件掩碼?為缺省022?,也可根據個人喜好將其設置為其他值,默認值為077)?
# Uncomment this to allow the anonymous FTP user to upload files. This only?
# has an effect if the above global write enable is activated. Also, you will?
# obviously need to create a directory writable by the FTP user.?
#anon_upload_enable=YES?(?是否允許匿名用戶上傳文件?,?須將?write_enable=YES?,?默認設置為?YES?允許?)?
# Uncomment this if you want the anonymous FTP user to be able to create?
# new directories.?
#anon_mkdir_write_enable=YES???(?是否允許匿名用戶創建新文件夾?,?默認設置為?YES?允許?)?
# Activate directory messages - messages given to remote users when they?
# go into a certain directory.?
#dirmessage_enable=YES?(?是否激活目錄歡迎信息功能?,?當用戶用?CMD??????模式首次訪問服務器上某個目錄時?,FTP?服務器將顯示歡迎信息?,?默認情況下?,?歡迎信息是通過?該?目錄下的?.message?文件獲得的,此文件保存自定義的歡迎信息,由用戶自己建立)?
# Activate logging of uploads/downloads.?
xferlog_enable=YES?(?默認值為?NO?如果啟用此選項,系統將會維護記錄服務器上傳和下載情況的日志文件,默認情況該日志文件為/var/log/vsftpd.log,也可以通過下面的?xferlog_file選項對其進行設定。)?
# Make sure PORT transfer connections originate from port 20 (ftp-data).?
connect_from_port_20=YES?(?設定?FTP?服務器將啟用?FTP?數據端口的連接請求?,ftp-data?數據傳輸?,21?為連接控制端口?)?
# If you want, you can arrange for uploaded anonymous files to be owned by?
# a different user. Note! Using "root" for uploaded files is not?
# recommended!-注意,不推薦使用root用戶上傳文件?
#chown_uploads=YES?(?設定是否允許?改變?上傳文件的屬主?,?與下面一個設定項配合使用?)?
#chown_username=whoeve?r?(?設置想要改變的上傳文件的屬主?,?如果需要?,?則輸入一個系統用戶名?,?例如可以把上傳的文件都改成?root?屬主。whoever:任何人)?
# You may override where the log file goes if you like. The default is shown?
# below.?
#xferlog_file=/var/log/vsftpd.log?(?設定系統維護記錄FTP服務器上傳和下載情況的日志文件,/var/log/vsftpd.log是默認的,也可以另設其它)?
# If you want, you can have your log file in standard ftpd xferlog format?
#xferlog_std_format=YES?(?如果啟用此選項?,?傳輸日志文件將以標準?xferlog?的格式書寫,該格式的日志文件默認為/var/log/xferlog,也可以通過xferlog_file選項對其進行設定,默認值為NO)?
#dual_log_enable?(?如果添加并啟用此選項,將生成兩個相似的日志文件,默認在/var/log/xferlog和/var/log/vsftpd.log目錄下。前者是wu_ftpd類型的傳輸日志,可以利用標準日志工具對其進行分析;后者是vsftpd類型的日志)?
#syslog_enable?(?如果添加并啟用此選項,則原本應該輸出到/var/log/vsftpd.log中的日志,將輸出到系統日志中)?
# You may change the default value for timing out an idle session.?
#idle_session_timeout=600?(設置數據傳輸中斷間隔時間,此語句表示空閑的用戶會話中斷時間為600秒,即當數據傳輸結束后,用戶連接FTP服務器的時間不應超過600秒,可以根據實際情況對該值進行修改)?
# You may change the default value for timing out a data connection.?
#data_connection_timeout=120?(?設置數據連接超時時間?,?該語句表示數據連接超時時間為?120?秒?,?可根據實際情況對其個修改?)?
# It is recommended that you define on your system a unique user which the?
# ftp server can use as a totally isolated and unprivileged user.?
#nopriv_user=ftpsecure?(?運行?vsftpd?需要的非特權系統用戶,缺省是nobody)?
# Enable this and the server will recognise asynchronous ABOR requests. Not?
# recommended for security (the code is non-trivial). Not enabling it,?
# however, may confuse older FTP clients.?
#async_abor_enable=YES?(?如果?FTP client?會下達“async ABOR”這個指令時,這個設定才需要啟用,而一般此設定并不安全,所以通常將其取消)?
# By default the server will pretend to allow ASCII mode but in fact ignore?
# the request. Turn on the below options to have the server actually do ASCII?
# mangling on files when in ASCII mode.?
# Beware that on some FTP servers, ASCII support allows a denial of service?
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd?
# predicted this attack and has always been safe, reporting the size of the?
# raw file.?
# ASCII mangling is a horrible feature of the protocol.?
#ascii_upload_enable=YES?(?大多數?FTP?服務器都選擇用?ASCII?方式傳輸數據?,?將?#?去掉就能實現用?ASCII?方式上傳和下載文件?)?
#ascii_download_enable=YES?(?將?#?去掉就能實現用?ASCII?方式下載文件?)?
# You may fully customise the login banner string:?
#ftpd_banner=Welcome to blah FTP service.?(將#去掉可設置登錄FTP服務器時顯示的歡迎信息,可以修改=后的歡迎信息內容。另外如在需要設置更改目錄歡迎信息的目錄下創建名為?.message?的文件,并寫入歡迎信息保存后,在進入到此目錄會顯示自定義歡迎信息?)?
# You may specify a file of disallowed anonymous e-mail addresses. Apparently?
# useful for combatting certain DoS attacks.?
#deny_email_enable=YES?(?可將某些特殊的?email address?抵擋住。如果以anonymous登錄服務器時,會要求輸入密碼,也就是您的email address,如果很討厭某些email address,就可以使用此設定來取消他的登錄權限,但必須與下面的設置項配合?)?
# (default follows)?
#banned_email_file=/etc/vsftpd/banned_emails?(當上面的?deny_email_enable=YES?時,可以利用這個設定項來規定那個email address不可登錄vsftpd服務器,此文件需用戶自己創建,一行一個email address即可!?)?
# 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?(?設置為?NO?時,用戶登錄FTP服務器后具有訪問自己目錄以外的其他文件的權限,?設置為?YES?時?,?用戶被鎖定在自己的?home?目錄中,vsftpd將在下面?chroot_list_file選項值的位置尋找?chroot_list文件,此文件需用戶建立,再將需鎖定在自己home目錄的用戶列入其中,每行一個用戶)?
# (default follows)?
#chroot_list_file=/etc/vsftpd/chroot_list?(?此文件需自己建立?,?被列入此文件的用戶?,?在登錄后將不能切換到自己目錄以外的其他目錄?,?由?FTP?服務器自動地?chrooted?到用戶自己的home目錄下,使得?chroot_list文件中的用戶不能隨意轉到其他用戶的FTP home目錄下,從而有利于FTP服務器的安全管理和隱私保護)?
# 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?(?是否允許遞歸查詢?,?大型站點的?FTP?服務器啟用此項可以方便遠程用戶查詢?)?
# When "listen" directive is enabled, vsftpd runs in standalone mode and?
# listens on IPv4 sockets. This directive cannot be used in conjunction?
# with the listen_ipv6 directive.?
listen=YES?(?如果設置為?YES?,?則?vsftpd?將以獨立模式運行,由vsftpd自己監聽和處理連接請求)?
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6?
# sockets, you must run two copies of vsftpd whith two configuration files.?
# Make sure, that one of the listen options is commented !!?
#listen_ipv6=YES?(?設定是否支持IPV6)?
#pam_service_name=vsftpd?(?設置?PAM?外掛模塊提供的認證服務所使用的配置文件名?,即/etc/pam.d/vsftpd文件,此文件中file=/etc/vsftpd/ftpusers字段,說明了PAM模塊能抵擋的帳號內容來自文件/etc/vsftpd/ftpusers中)?
#userlist_enable=YES/NO?(此選項默認值為NO ,此時ftpusers文件中的用戶禁止登錄FTP服務器;若此項設為YES,則?user_list文件中的用戶允許登錄???FTP服務器,而如果同時設置了?userlist_deny=YES?,則?user_list文件中的用戶將不允許登錄FTP服務器,甚至連輸入密碼提示信息都沒有,直接被FTP服務器拒絕)?
#userlist_deny=YES/NO?(此項默認為YES,設置是否阻扯user_list文件中的用戶登錄FTP服務器)?
tcp_wrappers=YES?(?表明服務器使用?tcp_wrappers?作為主機訪問控制方式,tcp_wrappers可以實現linux系統中網絡服務的基于主機地址的訪問控制,在/etc目錄中的?hosts.allow和hosts.deny兩個文件用于設置tcp_wrappers的訪問控制,前者設置允許訪問記錄,后者設置拒絕訪問記錄。例如?想限制某些主機對FTP服務器192.168.57.2的匿名訪問,編緝/etc/hosts.allow?文件,如在下面增加兩行命令:vsftpd:192.168.57.1ENY?和vsftpd:192.168.57.9ENY?表明限制IP為192.168.57.1/192.168.57.9主機訪問IP為192.168.57.2的FTP服務器,此時FTP服務器雖可以PING通,但無法連接)?