vsftpd.conf超詳解配置

1.默認配置

如下根據默認配置給出中文註釋 web

 

# Example config file /etc/vsftpd/vsftpd.conf shell

# 安全

# The default compiled in settings are fairly paranoid. This sample file 服務器

# loosens things up a bit, to make the ftp daemon more usable. session

# Please see vsftpd.conf.5 for all compiled in defaults. app

# socket

# READ THIS: This example file is NOT an exhaustive list of vsftpd options. async

# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's tcp

# capabilities. ide

#

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

anonymous_enable=YES 容許匿名用戶登陸

#

# Uncomment this to allow local users to log in.

local_enable=YES 容許系統用戶名登陸

#

# Uncomment this to enable any form of FTP write command.

write_enable=YES 容許使用任何能夠修改文件系統的FTP的指令

#

# 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 本地用戶新增檔案的權限

#

# 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 容許匿名用戶上傳文件

#

# Uncomment this if you want the anonymous FTP user to be able to create

# new directories.

#anon_mkdir_write_enable=YES 容許匿名用戶建立新目錄

#

# Activate directory messages - messages given to remote users when they

# go into a certain directory.

dirmessage_enable=YES容許爲目錄配置顯示信息,顯示每一個目錄下面的message_file文件的內容

#

# Activate logging of uploads/downloads.

xferlog_enable=YES開啓日記功能 

#

# Make sure PORT transfer connections originate from port 20 (ftp-data).

connect_from_port_20=YES使用標準的20端口來鏈接ftp 

#

# 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!

#chown_uploads=YES 全部匿名上傳的文件的所屬用戶將會被更改爲chown_username 

#chown_username=whoever 匿名上傳文件所屬用戶名 

#

# You may override where the log file goes if you like. The default is shown

# below.

#xferlog_file=/var/log/vsftpd.log日誌文件位置 

#

# If you want, you can have your log file in standard ftpd xferlog format

xferlog_std_format=YES 使用標準格式 

#

# You may change the default value for timing out an idle session.

#idle_session_timeout=600空閒鏈接超時 

#

# You may change the default value for timing out a data connection.

#data_connection_timeout=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 當服務器運行於最底層時使用的用戶名 

#

# 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 容許使用\"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 管控是否可用ASCII 模式上傳。默認值爲NO

#ascii_download_enable=YES管控是否可用ASCII 模式下載。默認值爲NO

#

# You may fully customise the login banner string:

#ftpd_banner=Welcome to blah FTP service.  login時顯示歡迎信息.若是設置了banner_file則此設置無效 

#

# You may specify a file of disallowed anonymous e-mail addresses. Apparently

# useful for combatting certain DoS attacks.

#deny_email_enable=YES 若是匿名用戶須要密碼,那麼使用banned_email_file裏面的電子郵件地址的用戶不能登陸

# (default follows)

#banned_email_file=/etc/vsftpd/banned_emails 禁止使用匿名用戶登錄時做爲密碼的電子郵件地址 

#

# 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_file中的使用者不能更改根目錄 

# (default follows)

#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 -R命令以防止浪費大量的服務器資源 

#

# 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  綁定到listen_port指定的端口,既然都綁定了也就是每時都開着的,就是那個什麼standalone模式 

#

# 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

 

pam_service_name=vsftpd   定義PAM 所使用的名稱,預設爲vsftpd

userlist_enable=YES  若啓用此選項,userlist_deny選項才被啓動 

tcp_wrappers=YES  開啓tcp_wrappers支持 

2.過濾配置文件多餘註釋

過濾掉那些註釋,以便咱們往後修改配置,你們能夠刪除vsftpd.conf內容,拷貝如下:

 

anonymous_enable=YES

local_enable=YES

write_enable=YES

local_umask=022

#anon_upload_enable=YES

#anon_mkdir_write_enable=YES

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

#chown_uploads=YES

#chown_username=whoever

#xferlog_file=/var/log/vsftpd.log

xferlog_std_format=YES

#idle_session_timeout=600

#data_connection_timeout=120

#nopriv_user=ftpsecure

#async_abor_enable=YES

#ascii_upload_enable=YES

#ascii_download_enable=YES

#ftpd_banner=Welcome to blah FTP service.

#deny_email_enable=YES

#banned_email_file=/etc/vsftpd/banned_emails

#chroot_list_enable=YES

#chroot_list_file=/etc/vsftpd/chroot_list

#ls_recurse_enable=YES

listen=YES

#listen_ipv6=YES

pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES

 

3.vsftpd.conf支持特性詳解

 

 

#################用戶選項############### 

接受匿名用戶 
anonymous_enable=YES 

#匿名用戶login時不詢問口令 
no_anon_password=YES
 
#匿名用戶主目錄 
anon_root=(none) 

#接受本地用戶 
local_enable=YES 

#本地用戶主目錄 
local_root=(none) 

#若是匿名用戶須要密碼,那麼使用banned_email_file裏面的電子郵件地址的用戶不能登陸 
deny_email_enable=YES 

#僅在沒有pam驗證版本時有用,是否檢查用戶有一個有效的shell來登陸 
check_shell=YES 

#若啓用此選項,userlist_deny選項才被啓動 
userlist_enable=YES 

#若爲YES,userlist_file中的用戶將不能登陸,NO則只有userlist_file的用戶能夠登陸 
userlist_deny=NO 

#若是和chroot_local_user一塊兒開啓,那麼用戶鎖定的目錄來自/etc/passwd每一個用戶指定的目錄(這個不是很清楚,很哪位熟悉的指點一下
passwd_chroot_enable=NO 

#定義匿名登入的使用者名稱。默認值爲ftp 
ftp_username=FTP 

#################用戶權限控制############### 

#能夠上傳(全局控制). 
write_enable=YES 

#本地用戶上傳文件的umask 
local_umask=022 

#上傳文件的權限配合umask使用 
#file_open_mode=0666 

#匿名用戶能夠上傳 
anon_upload_enable=NO 

#匿名用戶能夠建目錄 
anon_mkdir_write_enable=NO
 
匿名用戶其它的寫權利(更改權限?) 
anon_other_write_enable=NO 

若是設爲YES,匿名登入者會被容許下載可閱讀的檔案。默認值爲YES 
anon_world_readable_only=YES 

#若是開啓,那麼全部非匿名登錄的用戶名都會被切換成guest_username指定的用戶名 
#guest_enable=NO 

全部匿名上傳的文件的所屬用戶將會被更改爲chown_username 
chown_uploads=YES 

匿名上傳文件所屬用戶名 
chown_username=lightwiter 

#若是啓動這項功能,則全部列在chroot_list_file之中的使用者不能更改根目錄 
chroot_list_enable=YES 

#容許使用\"async ABOR\"命令,通常不用,容易出問題 
async_abor_enable=YES 

管控是否可用ASCII 模式上傳。默認值爲NO 
ascii_upload_enable=YES 

#管控是否可用ASCII 模式下載。默認值爲NO 
ascii_download_enable=YES 

#這個選項必須指定一個空的數據夾且任何登入者都不能有寫入的權限,當vsftpd 不須要file system 的權限時,就會將使用者限制在此數據夾中。默認值爲/usr/share/empty 
secure_chroot_dir=/usr/share/empty 

###################超時設置################## 

#空閒鏈接超時 
idle_session_timeout=600 

#數據傳輸超時 
data_connection_timeout=120 

#PAVS請求超時 
ACCEPT_TIMEOUT=60 

#PROT模式鏈接超時 
connect_timeout=60 

################服務器功能選項############### 

#開啓日記功能 
xferlog_enable=YES 

#使用標準格式 
xferlog_std_format=YES 

#xferlog_std_format關閉且本選項開啓時,記錄全部ftp請求和回覆,當調試比較有用
#log_ftp_protocol=NO 

#容許使用pasv模式 
pasv_enable=YES 

#關閉安全檢查,當心呀
#pasv_promiscuous+NO 

#容許使用port模式 
#port_enable=YES 

#關閉安全檢查 
#prot_promiscuous 

#開啓tcp_wrappers支持 
tcp_wrappers=YES 

#定義PAM 所使用的名稱,預設爲vsftpd 
pam_service_name=vsftpd 

#當服務器運行於最底層時使用的用戶名 
nopriv_user=nobody 

#使vsftpdpasv命令回覆時跳轉到指定的IP地址.(服務器聯接跳轉?) 
pasv_address=(none) 

#################服務器性能選項##############
 
#是否能使用ls -R命令以防止浪費大量的服務器資源 
#ls_recurse_enable=YES 

#是否使用單進程模式 
#one_process_model 

#綁定到listen_port指定的端口,既然都綁定了也就是每時都開着的,就是那個什麼standalone模式 
listen=YES 

#當使用者登入後使用ls -al 之類的指令查詢該檔案的管理權時,預設會出現擁有者的UID,而不是該檔案擁有者的名稱。如果但願出現擁有者的名稱,則將此功能開啓。 
text_userdb_names=NO 

#顯示目錄清單時是用本地時間仍是GMT時間,能夠經過mdtm命令來達到同樣的效果 
use_localtime=NO 

#測試平臺優化 
#use_sendfile=YES 

################信息類設置################ 

#login時顯示歡迎信息.若是設置了banner_file則此設置無效 
ftpd_banner=歡迎來到湖南三辰Fake-Ta FTP 網站

#容許爲目錄配置顯示信息,顯示每一個目錄下面的message_file文件的內容 
dirmessage_enable=YES 

#顯示會話狀態信息,
#setproctitle_enable=YES 

############## 文件定義 ################## 

#定義不能更改用戶主目錄的文件 
chroot_list_file=/etc/vsftpd/vsftpd.chroot_list 

#定義限制/容許用戶登陸的文件 
userlist_file=/etc/vsftpd/vsftpd.user_list 

#定義登陸信息文件的位置 
banner_file=/etc/vsftpd/banner 

#禁止使用的匿名用戶登錄時做爲密碼的電子郵件地址 
banned_email_file=/etc/vsftpd.banned_emails 

#日誌文件位置 
xferlog_file=/var/log/vsftpd.log 

#目錄信息文件 
message_file=.message 

############## 目錄定義 ################# 

#定義用戶配置文件的目錄 
user_config_dir=/etc/vsftpd/userconf 

#定義本地用戶登錄的根目錄,注意定義根目錄能夠是相對路徑也能夠是絕對路徑.相對路徑是針對用戶家目錄來講的
local_root=webdisk #此項設置每一個用戶登錄後其根目錄爲/home/username/webdisk 

#匿名用戶登錄後的根目錄 
anon_root=/var/ftp 

#############用戶鏈接選項################# 

#可接受的最大client數目 
max_clients=100 

#每一個ip的最大client數目 
max_per_ip=5 

#使用標準的20端口來鏈接ftp 
connect_from_port_20=YES 

#綁定到某個IP,其它IP不能訪問 
listen_address=192.168.0.2 

#綁定到某個端口 
#listen_port=2121 

#數據傳輸端口 
#ftp_data_port=2020 

#pasv鏈接模式時可使用port 範圍的上界,表示任意。默認值爲0 
pasv_max_port=0 

#pasv鏈接模式時可使用port 範圍的下界,表示任意。默認值爲0 
pasv_min_port=0 

##############數據傳輸選項################# 

#匿名用戶的傳輸比率(b/s) 
anon_max_rate=51200 

#本地用戶的傳輸比率(b/s) 
local_max_rate=5120000 

相關文章
相關標籤/搜索