分類: LINUX
account required /lib/security/pam_userdb.so db=/etc/vsftpd_login
local_enable=YES
write_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virtual
user_config_dir=/etc/vsftpd/(虛擬用戶庫中不同用戶的權限文件)
listen=YES
listen_port=10021
pasv_min_port=30000
pasv_max_port=30999
anon_world_readable_only=NO
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_world_readable_only=NO
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anno_other_writer_enable=YES
第六步: 啓動vsftpd(Start up vsftpd)
Connected to 192.168.1.2.
220 (vsFTPd 2.0.1)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (192.168.1.2:root): admin
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,1,2,119,247)
150 Here comes the directory listing.
226 Directory send OK.
ftp> pwd
257 "/"
ftp> cd /home
550 Failed to change directory.
ftp>
# ABOR - abort a file transfer
# CWD - change working directory
# DELE - delete a remote file
# LIST - list remote files
# MDTM - return the modification time of a file
# MKD - make a remote directory
# NLST - name list of remote directory
# PASS - send password
# PASV - enter passive mode
# PORT - open a data port
# PWD - print working directory
# QUIT - terminate the connection
# RETR - retrieve a remote file
# RMD - remove a remote directory
# RNFR - rename from
# RNTO - rename to
# SITE - site-specific commands
# SIZE - return the size of a file
# STOR - store a file on the remote host
# TYPE - set transfer type
# USER - send username
#
# less common commands:
# ACCT* - send account information
# APPE - append to a remote file
# CDUP - CWD to the parent of the current directory
# HELP - return help on using the server
# MODE - set transfer mode
# NOOP - do nothing
# REIN* - reinitialize the connection
# STAT - return server status
# STOU - store a file uniquely
# STRU - set file transfer structure
# SYST - return system type
===================================================
VSFTPD的本地用戶本身是系統的用戶,除了可以登錄FTP服務器外,還可以登錄系統使用其他系統資源,而
VSFTPD的虛擬用戶則是FTP服務的專用用戶,虛擬用戶只能訪問FTP服務器資源。對於只需要通過FTP對系統有讀
寫權限,而不需要其他系統資源的用戶或情況來說,採用虛擬用戶方式是很適合的。
VSFTPD的虛擬用戶採用單獨的用戶名/口令保存方式,與系統賬號(passwd/shadow)分離,這大大增強了
系統的安全性。VSFTPD可以採用數據庫文件來保存用戶/口令,如hash;也可以將用戶/口令保存在數據庫服務器
中,如MySQL等。VSFTPD驗證虛擬用戶,則採用PAM方式。由於虛擬用戶的用戶名/口令被單獨保存,因此在驗證
時,VSFTPD需要用一個系統用戶的身份來讀取數據庫文件或數據庫服務器以完成驗證,這就是guest用戶,這正
如同匿名用戶也需要有一個系統用戶ftp一樣。當然,guest用戶也可以被認爲是用於映射虛擬用戶。
配置虛擬用戶分爲幾部分:guest用戶的創建、用戶/口令的保存、PAM認證配置、vsftpd.conf文件設置等
。在後面的例子中,假定存在虛擬用戶win和wingger.
1、在系統中添加vsftpdvirtual用戶,作爲虛擬用戶在系統中的代表。
代碼: |
[root@Linux_win vsftpd]# useradd vsftpdvirtual |
當虛擬用戶登錄後,所在的位置爲vsftpdvirtual的自家目錄/home/vsftpdvirtual。
2、配置文件vsftpd.conf: 加入以下內容
guest_enable=YES
guest_username=vsftpdvirtual
virtual_use_local_privs=YES|NO
3、虛擬用戶的權限配置。
virtual_use_local_privs參數,
當該參數激活(YES)時,虛擬用戶使用與本地用戶相同的權限。所有虛擬用戶的權限使用local參數。
當此參數關閉(NO)時,虛擬用戶使用與匿名用戶相同的權限,所有虛擬用戶的權限使用anon參數。
這兩者種做法相比,後者更加嚴格一些,特別是在有寫訪問的情形下。默認情況下此參數是關閉的(NO)。
由於本人的vsftpd爲1.1.3,只好用virtual_use_local_privs=NO了:
因此匿名用戶的設置即是虛擬用戶的設置,在改參數權限時,同時也要修改目錄權限
如:讓用戶不能瀏覽目錄,但仍可以對文件操作且虛擬用戶目錄的權限改爲只能由vsftpdvirtual操作:
代碼: |
[root@Linux_win vsftpd]# chown vsftpdvirtual.vsftpdvirtual /home/vsftpdvirtual [root@Linux_win vsftpd]# chmod 700 /home/vsftpdvirtual |
由於這些設置對匿名用戶生效。最好是禁止匿名用戶登錄。
在VSFTPD-1.2.0以上版本,當virtual_use_local_privs=YES時,只需write_enable=YES,虛擬用戶就可以就擁
有寫權限。應該與本地用戶使用相同,有興趣的可以去驗證。
如果不同用戶使用不同的目錄,須加入權限
代碼: |
chown vsftpdvirtual.vsftpdvirtual /home/win chown vsftpdvirtual.vsftpdvirtual /home/wingger |
4、用MySQL保存虛擬用戶
1、虛擬用戶的用戶名/口令的保存。這部分在MySQL數據庫中完成。
首先,創建數據庫vsftpdvirtual以及表users,並插入虛擬用戶win、wingger。執行以下命令:
代碼: |
[root@Linux_win vsftpd]# #mysql -uroot -p mysql>create database vsftpdvirtual; mysql>use vsftpdvirtual; mysql>create table users(name char(16) binary,passwd char(16) binary); mysql>insert into users (name,passwd) values ('win',password('123456')); mysql>insert into users (name,passwd) values ('wingger',password('123456')); mysql>quit |
然後,授權vsftpdvirtual只能讀vsftpdvirtual數據庫的users表。執行以下命令:
代碼: |
[root@Linux_win vsftpd]# mysql -u root mysql -p mysql>grant select on vsftpdvirtual.users to vsftpdvirtual@localhost identified by '123456'; mysql>quit |
驗證剛纔的操作是否成功可以執行下面命令:
代碼: |
[root@Linux_win vsftpd]# mysql -u vsftpdvirtual -p123456 ftpdvirtual mysql>select * from users; |
如果成功,將會列出wing、wingger和加密後的密碼。
如下所示:
引用: |
mysql> select * from users; +---------+------------------+ | name | passwd | +---------+------------------+ | win | 23932fe477657768 | | wingger | 23932fe477657768 | +---------+------------------+ 2 rows in set (0.00 sec) |
2、設置PAM認證。這裏我們要用到一個利用mysql進行pam驗證的開源項目(http://sourceforge.net/proj
ects/pam-mysql/)。首先從網站下載它的程序包pam_myql-0.5.tar.gz。在編譯安裝之前,要確保mysql-devel
的RPM包已經安裝在你的機器上,如果沒有請從RHL安裝光盤中安裝該包。然後,執行以下命令:
代碼: |
[root@Linux_win vsftpd]# tar xvzf pam_mysql-0.5.tar.gz [root@Linux_win vsftpd]# cd pam_mysql [root@Linux_win vsftpd]# make [root@Linux_win vsftpd]# cp pam_mysql.so /bli/security |
接下來,我們要設置vsftpd的PAM驗證文件。打開/etc/pam.d/vsftpd文件,加入以下內容:
引用: |
auth required pam_mysql.so user=vsftpdvirtual passwd=123456 host=localhost db=vsftpdvirtual table=users usercolumn=name passwdcolumn=passwd crypt=2 account required pam_mysql.so user=vsftpdvirtual passwd=123456 host=localhost db=vsftpdvirtual table=users usercolumn=name passwdcolumn=passwd crypt=2 |
具體可查看vsftpd源包裏的EXAMPLE中的例子。
附:虛擬用戶文檔
1、vsftpd.conf配置文件
代碼: |
[root@Linux_win vsftpd]# cat vsftpd.conf listen=YES listen_address=192.168.1.2 anonymous_enable=NO local_enable=YES write_enable=YES #anon_root= anon_upload_enable=YES anon_other_write_enable=YES anon_mkdir_write_enable=YES #anon_world_readable_only=YES #anon_umask=777 #dirmessage_enable=YES ftpd_banner=welcome to this FTP server xferlog_enable=YES #xferlog_file=/var/log/vsftpd.log connect_from_port_20=YES #pasv_mix_port=50000 #pasv_max_port=60000 #xferlog_std_format=YES max_clients=10 max_per_ip=10 hide_ids=YES #limit all users in it's owner dir #chroot_local_user=YES #or limit some chroot_local_user=NO chroot_list_enable=YES chroot_list_file=/etc/vsftpd/chroot_list #use ownwer conf file user_config_dir=/etc/vsftpd/vsftpd_user_conf pam_service_name=/etc/pam.d/vsftpd guest_enable=YES guest_username=vsftpdvirtual #virtual_use_local_privs=NO |
代碼: |
2、[root@Linux_win vsftpd]# cat /etc/pam.d/vsftpd #%PAM-1.0 #auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd.ftpusers onerr=succeed #auth required pam_stack.so service=system-auth #auth required pam_shells.so #account required pam_stack.so service=system-auth #session required pam_stack.so service=system-auth auth required /lib/security/pam_mysql.so user=vsftpdvirtual passwd=123456 host=localhost db=vsftpdvirtual table=users usercolumn=name passwdcolumn=passwd crypt=2 account required /lib/security/pam_mysql.so user=vsftpdvirtual passwd=123456 host=localhost db=vsftpdvirtual table=users usercolumn=name passwdcolumn=passwd crypt=2 |
代碼: |
3、[root@Linux_win vsftpd]# cat /etc/vsftpd/chroot_list win wingger |
代碼: |
4、[root@Linux_win vsftpd]# ls -l /etc/vsftpd/vsftpd_user_conf 總用量 8 -rw-r--r-- 1 root root 21 1月 8 00:25 win -rw-r--r-- 1 root root 25 1月 8 00:17 wingger |
代碼: |
5、[root@Linux_win vsftpd]# cat /etc/vsftpd/vsftpd_user_conf/win local_root=/home/win [root@Linux_win vsftpd]# cat /etc/vsftpd/vsftpd_user_conf/wingger local_root=/home/wingger |
代碼: |
6、drwx------ 6 vsftpdvirtual vsftpdvirtual 4096 1月 8 00:16 vsftpdvirtual drwxrwxrwx 5 vsftpdvirtual vsftpdvirtual 4096 1月 8 01:47 win drwxrwxrwx 3 vsftpdvirtual vsftpdvirtual 4096 1月 8 20:19 wingger |
7、版本:(vsFTPd 1.1.3)、pam_mysql-0.5.tar.gz、mysql3.23.54
8、[root@Linux_win vsftpd]# mysql -u vsftpdvirtual -pchenwy vsftpdvirtual
mysql> select * from users;
+---------+------------------+
| name | passwd |
+---------+------------------+
| win | 23932fe477657768 |
| wingger | 23932fe477657768 |
+---------+------------------+
2 rows in set (0.00 sec)
vsftpd.conf - config file for vsftpd
vsftpd.conf may be used to control various aspects of vsftpd’s
behaviour. By default, vsftpd looks for this file at the location
/etc/vsftpd/vsftpd.conf. However, you may override this by specifying
a command line argument to vsftpd. The command line argument is the
pathname of the configuration file for vsftpd. This behaviour is use-
ful because you may wish to use an advanced inetd such as xinetd to
launch vsftpd with different configuration files on a per virtual host
basis.
FORMAT
The format of vsftpd.conf is very simple. Each line is either a com-
ment or a directive. Comment lines start with a # and are ignored. A
directive line has the format:
the option, = and value.
configuration file.
BOOLEAN OPTIONS
Below is a list of boolean options. The value for a boolean option may
be set to YES or NO.
allow_anon_ssl
Only applies if ssl_enable is active. If set to YES, anonymous
users will be allowed to use secured SSL connections.
If set to YES, anonymous users will be permitted to create new
directories under certain conditions. For this to work, the
option write_enable must be activated, and the anonymous ftp
user must have write permission on the parent directory.
If set to YES, anonymous users will be permitted to perform
write operations other than upload and create directory, such
as deletion and renaming. This is generally not recommended but
included for completeness.
If set to YES, anonymous users will be permitted to upload
files under certain conditions. For this to work, the option
write_enable must be activated, and the anonymous ftp user must
have write permission on desired upload locations.
When enabled, anonymous users will only be allowed to download
files which are world readable. This is recognising that the
ftp user may own files, especially in the presence of uploads.
Controls whether anonymous logins are permitted or not. If
enabled, both the usernames ftp and anonymous are recognised as
anonymous logins.
When enabled, ASCII mode data transfers will be honoured on
downloads.
When enabled, ASCII mode data transfers will be honoured on
uploads.
When enabled, a special FTP command known as "async ABOR" will
be enabled. Only ill advised FTP clients will use this fea-
ture. Additionally, this feature is awkward to handle, so it is
disabled by default. Unfortunately, some FTP clients will hang
when cancelling a transfer unless this feature is available, so
you may wish to enable it.
When enabled, and vsftpd is started in "listen" mode, vsftpd
will background the listener process. i.e. control will immedi-
ately be returned to the shell which launched vsftpd.
Note! This option only has an effect for non-PAM builds of
vsftpd. If disabled, vsftpd will not check /etc/shells for a
valid user shell for local logins.
When enables, allows use of the SITE CHMOD command. NOTE! This
only applies to local users. Anonymous users never get to use
SITE CHMOD.
If enabled, all anonymously uploaded files will have the owner-
ship changed to the user specified in the setting chown_user-
name. This is useful from an administrative, and perhaps secu-
rity, standpoint.
If activated, you may provide a list of local users who are
placed in a chroot() jail in their home directory upon login.
The meaning is slightly different if chroot_local_user is set
to YES. In this case, the list becomes a list of users which
are NOT to be placed in a chroot() jail. By default, the file
containing this list is /etc/vsftpd.chroot_list, but you may
override this with the chroot_list_file setting.
If set to YES, local users will be (by default) placed in a
chroot() jail in their home directory after login. Warning:
This option has security implications, especially if the users
have upload permission, or shell access. Only enable if you
know what you are doing. Note that these security implications
are not vsftpd specific. They apply to all FTP daemons which
offer to put local users in chroot() jails.
This controls whether PORT style data connections use port 20
(ftp-data) on the server machine. For security reasons, some
clients may insist that this is the case. Conversely, disabling
this option enables vsftpd to run with slightly less privilege.
If activated, you may provide a list of anonymous password e-
mail responses which cause login to be denied. By default, the
file containing this list is /etc/vsftpd.banned_emails, but you
may override this with the banned_email_file setting.
If set to NO, all directory list commands will give permission
denied.
If enabled, users of the FTP server can be shown messages when
they first enter a new directory. By default, a directory is
scanned for the file .message, but that may be overridden with
the configuration setting message_file.
If set to NO, all download requests will give permission
denied.
If enabled, two log files are generated in parallel, going by
default to /var/log/xferlog and /var/log/vsftpd.log. The for-
mer is a wu-ftpd style transfer log, parseable by standard
tools. The latter is vsftpd’s own style log.
If activated, files and directories starting with . will be
shown in directory listings even if the "a" flag was not used
by the client. This override excludes the "." and ".." entries.
Only applies if ssl_enable is activated. If activated, all non-
anonymous logins are forced to use a secure SSL connection in
order to send and receive data on data connections.
Only applies if ssl_enable is activated. If activated, all non-
anonymous logins are forced to use a secure SSL connection in
order to send the password.
If enabled, all non-anonymous logins are classed as "guest"
logins. A guest login is remapped to the user specified in the
guest_username setting.
If enabled, all user and group information in directory list-
ings will be displayed as "ftp".
vsftpd must not be run from an inetd of some kind. Instead, the
vsftpd executable is run once directly. vsftpd itself will then
take care of listening for and handling incoming connections.
Like the listen parameter, except vsftpd will listen on an IPv6
socket instead of an IPv4 one. This parameter and the listen
parameter are mutually exclusive.
Controls whether local logins are permitted or not. If enabled,
normal user accounts in /etc/passwd may be used to log in.
When enabled, all FTP requests and responses are logged, pro-
viding the option xferlog_std_format is not enabled. Useful for
debugging.
When enabled, this setting will allow the use of "ls -R". This
is a minor security risk, because a ls -R at the top level of a
large site may consume a lot of resources.
When enabled, this prevents vsftpd from asking for an anonymous
password - the anonymous user will log straight in.
When enabled, this prevents vsftpd from taking a file lock when
writing to log files. This option should generally not be
enabled. It exists to workaround operating system bugs such as
the Solaris / Veritas filesystem combination which has been
observed to sometimes exhibit hangs trying to lock log files.
If you have a Linux 2.4 kernel, it is possible to use a differ-
ent security model which only uses one process per connection.
It is a less pure security model, but gains you performance.
You really don’t want to enable this unless you know what you
are doing, and your site supports huge numbers of simultane-
ously connected users.
If enabled, along with chroot_local_user , then a chroot() jail
location may be specified on a per-user basis. Each user’s jail
is derived from their home directory string in /etc/passwd. The
occurrence of /./ in the home directory string denotes that the
jail is at that particular location in the path.
Set to NO if you want to disallow the PASV method of obtaining
a data connection.
Set to YES if you want to disable the PASV security check that
ensures the data connection originates from the same IP address
as the control connection. Only enable if you know what you
are doing! The only legitimate use for this is in some form of
secure tunnelling scheme, or perhaps to facilitate FXP support.
Set to NO if you want to disallow the PORT method of obtaining
a data connection.
Set to YES if you want to disable the PORT security check that
ensures that outgoing data connections can only connect to the
client. Only enable if you know what you are doing!
Set to YES if you want vsftpd to run as the user which launched
vsftpd. This is useful where root access is not available.
MASSIVE WARNING! Do NOT enable this option unless you totally
know what you are doing, as naive use of this option can create
massive security problems. Specifically, vsftpd does not / can-
not use chroot technology to restrict file access when this
option is set (even if launched by root). A poor substitute
could be to use a deny_file setting such as {/*,*..*}, but the
reliability of this cannot compare to chroot, and should not be
relied on. If using this option, many restrictions on other
options apply. For example, options requiring privilege such as
non-anonymous logins, upload ownership changing, connecting
from port 20 and listen ports less than 1024 are not expected
to work. Other options may be impacted.
Set to YES if you want only a specified list of e-mail pass-
words for anonymous logins to be accepted. This is useful as a
low-hassle way of restricting access to low-security content
without needing virtual users. When enabled, anonymous logins
are prevented unless the password provided is listed in the
file specified by the email_password_file setting. The file
format is one password per line, no extra whitespace. The
default filename is /etc/vsftpd.email_passwords.
This controls whether vsftpd attempts to maintain sessions for
logins. If vsftpd is maintaining sessions, it will try and
update utmp and wtmp. It will also open a pam_session if using
PAM to authenticate, and only close this upon logout. You may
wish to disable this if you do not need session logging, and
you wish to give vsftpd more opportunity to run with less pro-
cesses and / or less privilege. NOTE - utmp and wtmp support is
only provided with PAM enabled builds.
If enabled, vsftpd will try and show session status information
in the system process listing. In other words, the reported
name of the process will change to reflect what a vsftpd ses-
sion is doing (idle, downloading etc). You probably want to
leave this off for security purposes.
If enabled, and vsftpd was compiled against OpenSSL, vsftpd
will support secure connections via SSL. This applies to the
control connection (including login) and also data connections.
You’ll need a client with SSL support too. NOTE!! Beware
enabling this option. Only enable it if you need it. vsftpd can
make no guarantees about the security of the OpenSSL libraries.
By enabling this option, you are declaring that you trust the
security of your installed OpenSSL library.
Only applies if ssl_enable is activated. If enabled, this
option will permit SSL v2 protocol connections. TLS v1 connec-
tions are preferred.
Only applies if ssl_enable is activated. If enabled, this
option will permit SSL v3 protocol connections. TLS v1 connec-
tions are preferred.
Only applies if ssl_enable is activated. If enabled, this
option will permit TLS v1 protocol connections. TLS v1 connec-
tions are preferred.
If enabled, then any log output which would have gone to
/var/log/vsftpd.log goes to the system log instead. Logging is
done under the FTPD facility.
If enabled, and vsftpd was compiled with tcp_wrappers support,
incoming connections will be fed through tcp_wrappers access
control. Furthermore, there is a mechanism for per-IP based
configuration. If tcp_wrappers sets the VSFTPD_LOAD_CONF envi-
ronment variable, then the vsftpd session will try and load the
vsftpd configuration file specified in this variable.
By default, numeric IDs are shown in the user and group fields
of directory listings. You can get textual names by enabling
this parameter. It is off by default for performance reasons.
If enabled, vsftpd will try and resolve pathnames such as
~chris/pics, i.e. a tilde followed by a username. Note that
vsftpd will always resolve the pathnames ~ and ~/something (in
this case the ~ resolves to the initial login directory). Note
that ~user paths will only resolve if the file /etc/passwd may
be found within the _current_ chroot() jail.
If enabled, vsftpd will display directory listings with the
time in your local time zone. The default is to display GMT.
The times returned by the MDTM FTP command are also affected by
this option.
An internal setting used for testing the relative benefit of
using the sendfile() system call on your platform.
This option is examined if userlist_enable is activated. If you
set this setting to NO, then users will be denied login unless
they are explicitly listed in the file specified by
userlist_file. When login is denied, the denial is issued
before the user is asked for a password.
If enabled, vsftpd will load a list of usernames, from the
filename given by userlist_file. If a user tries to log in
using a name in this file, they will be denied before they are
asked for a password. This may be useful in preventing cleart-
ext passwords being transmitted. See also userlist_deny.
If enabled, virtual users will use the same privileges as local
users. By default, virtual users will use the same privileges
as anonymous users, which tends to be more restrictive (espe-
cially in terms of write access).
This controls whether any FTP commands which change the
filesystem are allowed or not. These commands are: STOR, DELE,
RNFR, RNTO, MKD, RMD, APPE and SITE.
If enabled, a log file will be maintained detailling uploads
and downloads. By default, this file will be placed at
/var/log/vsftpd.log, but this location may be overridden using
the configuration setting vsftpd_log_file.
If enabled, the transfer log file will be written in standard
xferlog format, as used by wu-ftpd. This is useful because you
can reuse existing transfer statistics generators. The default
format is more readable, however. The default location for this
style of log file is /var/log/xferlog, but you may change it
with the setting xferlog_file.
NUMERIC OPTIONS
Below is a list of numeric options. A numeric option must be set to a
non negative integer. Octal numbers are supported, for convenience of
the umask options. To specify an octal number, use 0 as the first
digit of the number.
accept_timeout
The timeout, in seconds, for a remote client to establish con-
nection with a PASV style data connection.
The maximum data transfer rate permitted, in bytes per second,
for anonymous clients.
The value that the umask for file creation is set to for anony-
mous users. NOTE! If you want to specify octal values, remember
the "0" prefix otherwise the value will be treated as a base 10
integer!
The timeout, in seconds, for a remote client to respond to our
PORT style data connection.
The timeout, in seconds, which is roughly the maximum time we
permit data transfers to stall for with no progress. If the
timeout triggers, the remote client is kicked off.
The permissions with which uploaded files are created. Umasks
are applied on top of this value. You may wish to change to
0777 if you want uploaded files to be executable.
The port from which PORT style connections originate (as long
as the poorly named connect_from_port_20 is enabled).
The timeout, in seconds, which is the maximum time a remote
client may spend between FTP commands. If the timeout triggers,
the remote client is kicked off.
If vsftpd is in standalone mode, this is the port it will lis-
ten on for incoming FTP connections.
The maximum data transfer rate permitted, in bytes per second,
for local authenticated users.
The value that the umask for file creation is set to for local
users. NOTE! If you want to specify octal values, remember the
"0" prefix otherwise the value will be treated as a base 10
integer!
If vsftpd is in standalone mode, this is the maximum number of
clients which may be connected. Any additional clients connect-
ing will get an error message.
If vsftpd is in standalone mode, this is the maximum number of
clients which may be connected from the same source internet
address. A client will get an error message if they go over
this limit.
The maximum port to allocate for PASV style data connections.
Can be used to specify a narrow port range to assist fire-
walling.
The minimum port to allocate for PASV style data connections.
Can be used to specify a narrow port range to assist fire-
walling.
You probably don’t want to change this, but try setting it to
something like 8192 for a much smoother bandwidth limiter.
STRING OPTIONS
Below is a list of string options.
anon_root
This option represents a directory which vsftpd will try to
change into after an anonymous login. Failure is silently
ignored.
This option is the name of a file containing a list of anony-
mous e-mail passwords which are not permitted. This file is
consulted if the option deny_email_enable is enabled.
This option is the name of a file containing text to display
when someone connects to the server. If set, it overrides the
banner string provided by the ftpd_banner option.
This is the name of the user who is given ownership of anony-
mously uploaded files. This option is only relevant if another
option, chown_uploads, is set.
The option is the name of a file containing a list of local
users which will be placed in a chroot() jail in their home
directory. This option is only relevant if the option
chroot_list_enable is enabled. If the option chroot_local_user
is enabled, then the list file becomes a list of users to NOT
place in a chroot() jail.
This options specifies a comma separated list of allowed FTP
commands (post login. USER, PASS and QUIT are always allowed
pre-login). Other commands are rejected. This is a powerful
method of really locking down an FTP server. Example:
cmds_allowed=PASV,RETR,QUIT
This option can be used to set a pattern for filenames (and
directory names etc.) which should not be accessible in any
way. The affected items are not hidden, but any attempt to do
anything to them (download, change into directory, affect some-
thing within directory etc.) will be denied. This option is
very simple, and should not be used for serious access control
- the filesystem’s permissions should be used in preference.
However, this option may be useful in certain virtual user
setups. In particular aware that if a filename is accessible by
a variety of names (perhaps due to symbolic links or hard
links), then care must be taken to deny access to all the
names. Access will be denied to items if their name contains
the string given by hide_file, or if they match the regular
expression specified by hide_file. Note that vsftpd’s regular
expression matching code is a simple implementation which is a
subset of full regular expression functionality. Because of
this, you will need to carefully and exhaustively test any
application of this option. And you are recommended to use
filesystem permissions for any important security policies due
to their greater reliability. Example:
deny_file={*.mp3,*.mov,.private}
This option specifies the location of the DSA certificate to
use for SSL encrypted connections.
This option can be used to provide an alternate file for usage
by the secure_email_list_enable setting.
This is the name of the user we use for handling anonymous FTP.
The home directory of this user is the root of the anonymous
FTP area.
This string option allows you to override the greeting banner
displayed by vsftpd when a connection first comes in.
See the boolean setting guest_enable for a description of what
constitutes a guest login. This setting is the real username
which guest users are mapped to.
This option can be used to set a pattern for filenames (and
directory names etc.) which should be hidden from directory
listings. Despite being hidden, the files / directories etc.
are fully accessible to clients who know what names to actually
use. Items will be hidden if their names contain the string
given by hide_file, or if they match the regular expression
specified by hide_file. Note that vsftpd’s regular expression
matching code is a simple implementation which is a subset of
full regular expression functionality. Example:
hide_file={*.mp3,.hidden,hide*,h?}
If vsftpd is in standalone mode, the default listen address (of
all local interfaces) may be overridden by this setting. Pro-
vide a numeric IP address.
Like listen_address, but specifies a default listen address for
the IPv6 listener (which is used if listen_ipv6 is set). Format
is standard IPv6 address format.
This option represents a directory which vsftpd will try to
change into after a local (i.e. non-anonymous) login. Failure
is silently ignored.
This option is the name of the file we look for when a new
directory is entered. The contents are displayed to the remote
user. This option is only relevant if the option dirmes-
sage_enable is enabled.
This is the name of the user that is used by vsftpd when it
wants to be totally unprivileged. Note that this should be a
dedicated user, rather than nobody. The user nobody tends to be
used for rather a lot of important things on most machines.
This string is the name of the PAM service vsftpd will use.
Use this option to override the IP address that vsftpd will
advertise in response to the PASV command. Provide a numeric IP
address.
nected socket)
This option specifies the location of the RSA certificate to
use for SSL encrypted connections.
This option should be the name of a directory which is empty.
Also, the directory should not be writable by the ftp user.
This directory is used as a secure chroot() jail at times
vsftpd does not require filesystem access.
This option can be used to select which SSL ciphers vsftpd will
allow for encrpyted SSL connections. See the ciphers man page
for further details. Note that restricting ciphers can be a
useful security precaution as it prevents malicious remote par-
ties forcing a cipher which they have found problems with.
This powerful option allows the override of any config option
specified in the manual page, on a per-user basis. Usage is
simple, and is best illustrated with an example. If you set
user_config_dir to be /etc/vsftpd_user_conf and then log on as
the user "chris", then vsftpd will apply the settings in the
file /etc/vsftpd_user_conf/chris for the duration of the ses-
sion. The format of this file is as detailed in this manual
page! PLEASE NOTE that not all settings are effective on a per-
user basis. For example, many settings only prior to the user’s
session being started. Examples of settings which will not
affect any behviour on a per-user basis include listen_address,
banner_file, max_per_ip, max_clients, xferlog_file, etc.
This option is useful is conjunction with virtual users. It is
used to automatically generate a home directory for each vir-
tual user, based on a template. For example, if the home direc-
tory of the real user specified via guest_username is
/home/virtual/$USER, and user_sub_token is set to $USER, then
when virtual user fred logs in, he will end up (usually
chroot()’ed) in the directory /home/virtual/fred. This option
also takes affect if local_root contains user_sub_token.
This option is the name of the file loaded when the
userlist_enable option is active.
This option is the name of the file to which we write the
vsftpd style log file. This log is only written if the option
xferlog_enable is set, and xferlog_std_format is NOT set.
Alternatively, it is written if you have set the option
dual_log_enable. One further complication - if you have set
syslog_enable, then this file is not written and output is sent
to the system log instead.
This option is the name of the file to which we write the wu-
ftpd style transfer log. The transfer log is only written if
the option xferlog_enable is set, along with xferlog_std_for-
mat. Alternatively, it is written if you have set the option
dual_log_enable.
VSFTPD.CONF(5)