EnvOS: centos5.4finalftp: vsftpd-2.0.51, you can first create a user through newusers or scripts, the required user name needs to be written in a document in advance in the format of one per line, then, execute useradd. shUseradd. sh content :#! /Bin/bashforiin...
Env
OS: centos 5.4 final
Ftp: vsftpd-2.0.5
1. you can use newusers or scripts to create a new user. you need to write the user name in a document in the format of one digit per line through the script. then, execute useradd. sh
Useradd. sh content:
#! /Bin/bash
For I in 'cat./';
Do
Mkidr web/ftp/$ I;
Useradd $ I-s/sbin/nologin-d/web/ftp/$ I-g tb; # The tb group must be created in advance.
Echo 123456 | passwd-stdin $ I;
Done
If you need to create an FTP user in the future, enter the command useradd $ FTPuser-s/bin/nologin-d/web/ftp/$ FTPuser; echo 123456 | passwd-stdin $ FTPuser;
2. after you create a vsftpd instance, start vsftpd and configure the configuration file.
1, service vsftpd start
2 Vim/etc/vsftpd/vsftd. conf
#! /Bin/bash # Comment
Anonymous_enable = NO # Anonymous user logon not allowed
No_anon_password = NO
Local_enable = YES # Allow local users to log on
Write_enable = YES # Allow local users to write data
Local_umask = 000 # specify ugoa permissions
Anon_upload_enable = NO # upload is not allowed by anonymous users.
Anon_mkdir_write_enable = YES # anonymous users are not allowed to create folders.
Dirmessage_enable = YES # Welcome page information
Xferlog_enable = YES # logs that can be recorded are stored in/var/log/vferlog by default.
Connect_from_port_20 = YES # Allow logon in passive mode
Xferlog_file =/var/log/xferlog # specify the xferlog file directory
Ftpd_banner = Welcome to TechBridge. inc. FTP service. # specify the Welcome information on the interface.
Chroot_list_enable = YES # Banned user logon Directory
Chroot_list_file =/etc/vsftpd/chroot_list # specify the user to be banned under/etc/vsftpd/chroot_list
Listen = YES # enable listening
Local_max_rate = 128000 # maximum local user upload speed (128 k/s)
Max_per_ip = 20 # maximum connected IP
Userlist_enable = YES #/etc/vsftpd/userlist list users are not allowed to log on (such as root)
Tcp_wrappers = YES # enable tcp_wrappers
Local_root =/web/ftp/# specify the local directory
3. after modifying/etc/vsftpd. conf, configure/etc/vsftpd/chroot_list to specify which users need to be banned from the home directory.
4. create a folder under/web/ftp and set permissions.
Drwxrwxrw-3 mike. zhu tb 4096 12-29 15:34 tools
Drwxrw-r-x 51 root 4096 12-29 users
Restart vsftpd.
Service vsftpd restart
This article is from the "gdnotepad" blog