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