Check whether vsftp is installed in the system.
Rpm-q vsftpd
Package vsftpd is not installed # This indicates that vsftpd is not installed in the system.
If the following error occurs when a virtual user data file is generated
Users. db-bash: db_load: command not found
Because the software package is not installed when the db command is executed
Db4
Db4-devel
Db4-java
Db4-tcl
Db4-utils
You can run the yum install db4 * command to install
Install vsftpd
Yum install vsftpd
Press Y and press enter to automatically install
/Etc/init. d/vsftpd start # start vsftpd
Service vsftpd restart # restart
Service vsftpd stop # stop
Chkconfig vsftpd on # It is convenient to set Automatic startup on THE wdcp panel and stop another FTP service.
Log on to the root account in vsftp:
1) EDIT two FTP configuration files:/etc/vsftpd/ftpusers and/etc/vsftpd/user_list, and delete the root line or comment out;
You need to modify it without modifying it.
Configure a vsftp Server
Configuration File description:
Core configuration file of/etc/vsftpd. conf vsftpd
/Etc/vsftpd/ftpusers is used to specify which users cannot access the FTP server
/Etc/vsftpd/user_list specifies the list of users that can use vsftpd
/Etc/vsftpd/vsftpd_conf_migrate.sh is a variable and setting Script For vsftpd operations.
/Var/ftp/root directory of anonymous users by default
Configure/etc/vsftpd. conf
Back up data before configuration
Cp/etc/vsftpd. conf/etc/vsftpd. confbak
Restore Files
Cp/etc/vsftpd. confbak/etc/vsftpd. conf
Vi/etc/vsftpd. conf # Configuration
Just add
Anonymous_enable = NO # disable anonymous users. Change it in the original directory.
Guest_enable = YES sets to enable the virtual user function.
Guest_username = vsftpd specifies the host user of the virtual user (this is the user we will create later)
User_config_dir =/etc/vsftpd/vconf set the path for storing the configuration file of the virtual user's personal Vsftp.
That is to say, the specified directory will store the configuration file of each Vsftp virtual user personality.
The configuration file name must be the same as the virtual user name.
For example, if you copy the configuration file of vsftpd. conf to this directory, You need to perform a music video and configure it as the virtual user name.
Virtual_use_local_privs = YES # When this parameter is activated (YES), virtual users use the same permissions as local users.
# When this parameter is disabled (NO), virtual users use the same permissions as anonymous users. By default, this parameter is disabled (NO ).
Pasv_min_port = 9000 (set the port range in passive mode)
Pasv_max_port = 9045 (set the port range in passive mode)
Accept_timeout = 5 # Keep for 5 seconds
Connect_timeout = 1 # reconnect after 1 second
Chroot_local_user = YES is restricted to the current directory.
Press the s key to edit the file. You can edit the file. The file is also case-sensitive. Press ZZ twice in a row to save the file and exit editing.
First create a virtual user name single file:
Touch/etc/vsftpd/virtusers
Edit the virtual user name single file: (the first line of the account, the second line of the password, Note: Do not use root as the user name, the system retains)
Vi/etc/vsftpd/virtusers
Up
123456
Generate a virtual user data file:
Db_load-T-t hash-f/etc/vsftpd/virtusers. db
Chmod 600/etc/vsftpd/virtusers. db # Set the PAM Authentication file and specify to read the virtual user database file ====
Add the following information to the file header of/etc/pam. d/vsftpd (the following information is invalid)
Back up cp/etc/pam. d/vsftpd/etc/pam. d/vsftpdbak before modification
Recover cp/etc/pam. d/vsftpdbak/etc/pam. d/vsftpd
Vi/etc/pam. d/vsftpd
Auth sufficient/lib64/security/pam_userdb.so db =/etc/vsftpd/virtusers
Account sufficient/lib64/security/pam_userdb.so db =/etc/vsftpd/virtusers
Note: If the system is 64, the above lib is changed to lib64; otherwise, the configuration fails.
Create a new system user vsftpd. the user's home directory is/home/wwwroot, and the user logon terminal is set to/bin/false (even if the user cannot log on to the system)
Useradd-d/home/wwwroot-s/bin/false-g ftp vsftpd add to FTP User Group
Chown vsftpd: ftp/home/wwwroot-R
Create a configuration file for the virtual user's personal Vsftp
System O & M reminder: qihang01 original content is copyrighted. For more information, see the source and original article links.
Mkdir/etc/vsftpd/vconf
Cd/etc/vsftpd/vconf
Touch up # create three virtual user configuration files
Vi up # edit the user's web1 configuration file. Others are similar to this configuration file.
Local_root =/home/wwwroot/
Write_enable = yes
Local_umask = 002
Cmds_allowed = FEAT, REST, CWD, LIST, MDTM, MKD, NLST, PASS, PASV, PORT, PWD, QUIT, RMD, SIZE, STOR, TYPE, USER, ACCT, APPE, CDUP, HELP, MODE, NOOP, REIN, STAT, STOU, STRU, SYST
Chroot_list_enable = YES
Pam_service_name = vsftpd
Pasv_enable = yes
Hide_ids = YES
Text_userdb_names = no
Ls_recurse_enable = no
Upload only
Restart the vsftpd server.
/Etc/init. d/vsftpd restart
Note: guest_username = vsftpd # specifies the host user of the virtual user (the user we created earlier)
For example, if the ftp directory directs to the root directory of the website
Guest_username = apache # specifying the virtual user's host user as the apache running account can avoid many permission settings Problems
I have modified the above configurations based on my online tutorials. Many online tutorials cannot run directly...
Two FTP switches can be controlled on the WDcp panel
This control panel is very practical
This article is taken from the wdlinux Forum http://www.wdlinux.cn/bbs/. For more information, see!