With online installation
Yum Install vsftpd pam* db4*-y
To configure VSFTP as a system service using the command
Chkconfig--level vsftpd on
- 2
Configuring the host for the VSFTPD service
Useradd vsftpdadmin-s/sbin/nologin-m
This vsftpdadmin is only used to replace root and does not require login
- 3
Establish an FTP virtual hosting account
Useradd vsftpuser-s/sbin/nologin-m
This ftpuser only the host of a virtual account, which itself is not logged in
-
Configure the vsftpd.conf configuration before you first back up the original
vi/etc/vsftpd/vsftpd.conf
anonymous_enable=yes --> anonymous_enable=no //Do not allow anonymous user access, The default is Allow.
chroot_list_enable=yes --> chroot_list_enable=yes // FTP users are not allowed to leave their home directory
To increase the
#设定虚拟用户个人Vsftp的配置文件存放路径. That is, the specified directory, will be stored in each vsftp virtual user personality profile, one need to note that these configuration file names must be the same as the virtual user name.
user_config_dir=/etc/vsftpd/vconf/userlocal
#这一步非常重要, remember this step. A new folder will be created according to this configuration
#修改端口号
ftp_data_port=4040
Reverse_lookup_enable=no
Pasv_enable=yes
pasv_min_port=48790
pasv_max_port=48800
The listen_port=48796 #端口可以根据你自己实际情况配置, or it can be used with the default port. But for security reasons, configure
Create a virtual user file
Mkdir/etc/vsftpd/vconf
Touch/etc/vsftpd/vonf/vir_user
Create a virtual user
Vi/etc/vsftpd/vonf/vir_user
virtualuser //user name
12345678 //password
Build Database
Db_load-t-T Hash-f/etc/vsftpd/vconf/vir_user/etc/vsftpd/vconf/vir_user.db
Set Database file access permissions
chmod 600/etc/vsftpd/vconf/vir_user
chmod 600/etc/vsftpd/vconf/vir_user.db
Modify/ETC/PAM.D/VSFTPD
Auth sufficient pam_userdb.so Db=/etc/vsftpd/vconf/vir_user
Account sufficient pam_userdb.so Db=/etc/vsftpd/vconf/vir_user
(To use both the system user and the virtual user, you need to change the required to sufficient)
According to the fourth step configuration user_config_dir=/etc/vsftpd/vconf/userlocal
New Userlocal Folder
Mkdir/etc/vsftpd/vconf/userlocal
Create a file based on the user name established in step sixth
For example, the sixth step establishes the account number is Virtualuser, then creates a new Virtualuser file
Touch/etc/vsftpd/conf/userlocal/virtualuser
Edit the file path that the user accesses
Vi/etc/vsftpd/conf/userlocal/virtualuser
Enter the following
local_root=//need to specify the site root directory, for example www.baidu.com is located in the folder/www/baidu
Anonymous_enable=no #禁止匿名用户访问
Write_enable=yes #开启写权限
local_umask=022 #上传后文件的权限掩码
Anon_upload_enable=no #关闭匿名下载
Anon_mkdir_write_enable=no #关闭匿名创建文件夹
Idle_session_timeout=60 #会话自动关闭时间 60 is for minutes
data_connection_timeout=120 #数据延迟时间
max_clients=10 #最大连接数
Max_per_ip=5 #同一个ip同时允许5个IP联机
local_max_rate=1048576 #实体用户传输速度限制, Unit b/S. 0 means no Limit
Configure this to complete, restart the VSFTPD service: Service vsftpd restart.
Check the system port status: NETSTAS-TULNP. If you can see that port 48796 is being vsftpd invoked, the boot succeeds.