代码: |
[root@Linux_win vsftpd]#rpm -ivh vsftpd-1.1.3-8.i386.rpm |
代码: |
[root@Linux_win vsftpd]# useradd nobody |
代码: |
[root@hpe45 root]# mkdir /usr/share/empty/ |
代码: |
[root@Linux_win vsftpd]# mkdir /var/ftp/ [root@Linux_win vsftpd]# useradd -d /var/ftp ftp |
代码: |
[root@Linux_win vsftpd]# chown root.root /var/ftp [root@Linux_win vsftpd]# chmod og-w /var/ftp |
代码: |
[root@Linux_win vsftpd]# tar zxvf vsftpd-1.2.0.tar.gz [root@Linux_win vsftpd]# cd vsftpd-1.2.0 [root@Linux_win vsftpd]# make |
代码: |
[root@Linux_win vsftpd]# cp vsftpd /usr/local/sbin/vsftpd [root@Linux_win vsftpd]# cp vsftpd.conf.5 /usr/local/share/man/man5 [root@Linux_win vsftpd]# cp vsftpd.8 /usr/local/share/man/man8 |
代码: |
[root@Linux_win vsftpd]#mkdir /usr/local/share/man/man5 [root@Linux_win vsftpd]#mkdir /usr/local/share/man/man8 |
代码: |
[root@Linux_win vsftpd]# cp RedHat/vsftpd.pam /etc/pam.d/vsftpd |
代码: |
[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 /lib/security |
代码: |
[root@Linux_win software]# service vsftpd restart |
代码: |
[root@Linux_win vsftpd]# /sbin/service xinetd restart 或 [root@Linux_win vsftpd]# /usr/local/sbin/vsftpd & |
代码: |
/etc/rc.d/init.d/vsftpd start|stop|restart |
代码: |
[root@Linux_win vsftpd]#vi /etc/vsftpd/vsftpd.conf或vi /etc/vsftp.conf listen=NO |
代码: |
[root@Linux_win vsftpd]vi /etc/xinetd.d/vsftpd 内容如下: service vsftpd { disable = no socket_type = stream wait = no user = root server = /usr/sbin/vsftpd port = 21 log_on_success += PID HOST DURATION log_on_failure += HOST } |
代码: |
[root@Linux_win vsftpd]#vi /etc/vsftpd.conf或/etc/vsftpd/vsftpd.conf |
引用: |
#使用单独模式,并指定监听的IP地址 listen_address=ip address #只允许匿名访问,不允许本地用户访问 anonymous_enable=YES local_enable=NO #取消写权限 write_enable=NO anon_upload_enable=NO anon_mkdir_write_enable=NO anon_other_write_enable=NO #启用详细的日志记录格式,设定记录传输日志的文件名。默认值为/var/log/vsftpd.log。 xferlog_enable=YES xferlog_file=/var/log/vsftp.log #对连接进行控制,还有超时时间,那就根据具体情况再说了。 connect_from_port_20=YES pasv_min_port=50000 pasv_max_port=60000 #控制FTP最大并发数,限定每个IP地址的并发数。 max_clients=numerical value max_per_ip=numerical value #限定下载速度 anon_max_rate=80000 #使用ftpd_banner取代VSFTPD默认的欢迎词,免得泄漏相关信息 ftpd_banner=Welcome to this FTP Server #只让匿名用户浏览可阅读的文件,不可以浏览整个系统 anon_world_readable_only=YES #隐藏文件的所有者和组信息,匿名用户看到的文件的所有者和组全变为ftp hide_ids=YES |
代码: |
附:vsftpd.conf [root@Linux_win vsftpd]# cat vsftpd.conf listen=YES listen_address=192.168.1.2 anonymous_enable=YES local_enable=NO write_enable=NO anon_root=/home anon_upload_enable=NO anon_other_write_enable=NO anon_mkdir_write_enable=NO anon_world_readable_only=YES #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 #chroot_list_enable=YES #chroot_list_file=/etc/vsftpd/chroot_list #chroot_local_user=NO #pam_service_name=/etc/pam.d/vsftpd #guest_enable=YES #guest_username=vsftpdvirtual #virtual_use_local_privs=NO #user_config_dir=/etc/vsftpd/vsftpd_user_conf |
代码: |
[root@Linux_win ftp]# cat /etc/vsftpd/vsftpd.conf listen=YES listen_address=192.168.1.2 anonymous_enable=YES local_enable=NO write_enable=YES #anon_root= anon_upload_enable=YES anon_other_write_enable=YES anon_mkdir_write_enable=YES #anon_world_readable_only=YES #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 #chroot_list_enable=YES #chroot_list_file=/etc/vsftpd/chroot_list #chroot_local_user=NO #pam_service_name=/etc/pam.d/vsftpd #guest_enable=YES #guest_username=vsftpdvirtual #virtual_use_local_privs=NO #user_config_dir=/etc/vsftpd/vsftpd_user_conf |
代码: |
[root@Linux_win ftp]# mkidr /var/ftp/upload [root@Linux_win ftp]# chmod o+w /var/ftp/upload |
代码: |
[root@Linux_win vsftpd]# cat /etc/vsftpd/vsftpd.conf listen=YES listen_address=192.168.1.2 anonymous_enable=NO local_enable=YES #local_root= 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 |
代码: |
[root@Linux_win vsftpd]# touch /etc/vsftpd/chroot_list |
代码: |
[root@Linux_win vsftpd]# cat /etc/vsftpd/chroot_list sam gem |
代码: |
[root@Linux_win vsftpd]# mkdir /etc/vsftpd/vsftpd_user_conf |
代码: |
[root@Linux_win vsftpd]# touch sam [root@Linux_win vsftpd]# touch gem [root@Linux_win vsftpd]# ls -l /etc/vsftpd/vsftpd_user_conf 总用量 8 -rw-r--r-- 1 root root 21 1月 8 00:25 sam -rw-r--r-- 1 root root 25 1月 8 00:17 gem |
代码: |
[root@Linux_win vsftpd]# cat /etc/vsftpd/vsftpd_user_conf/sam local_root=/home/sam |
代码: |
[root@Linux_win vsftpd]# cat /etc/vsftpd/vsftpd_user_conf/gem local_root=/home/gem |
代码: |
[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 |
代码: |
[root@Linux_win vsftpd]# useradd vsftpdvirtual |
代码: |
[root@Linux_win vsftpd]# chown vsftpdvirtual.vsftpdvirtual /home/vsftpdvirtual [root@Linux_win vsftpd]# chmod 700 /home/vsftpdvirtual |
代码: |
chown vsftpdvirtual.vsftpdvirtual /home/win chown vsftpdvirtual.vsftpdvirtual /home/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 |
代码: |
[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; |
引用: |
mysql> select * from users; +---------+------------------+ | name | passwd | +---------+------------------+ | win | 23932fe477657768 | | wingger | 23932fe477657768 | +---------+------------------+ 2 rows in set (0.00 sec) |
代码: |
[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 |
引用: |
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 |
代码: |
[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 |