分类: LINUX
2006-09-07 20:36:57
#apt-get install vsftpd |
debian:/etc# cat /etc/vsftpd.conf|grep -v "#" listen=YES anonymous_enable=YES #允许匿名用户登录 local_enable=YES #Vsftpd所在系统的用户可以登录系统 write_enable=YES # 允许修改 , 全局 anon_upload_enable=YES #匿名上传 anon_mkdir_write_enable=YES #匿名新建和写 dirmessage_enable=YES #起用提示功能,欢迎词等 xferlog_enable=YES #打开日志文件 connect_from_port_20=YES #控制用port模式传输数据使用2端口 xferlog_file=/var/log/vsftpd.log #日志文件路径 ftpd_banner=Welcome to FTP service. #登录欢迎词 secure_chroot_dir=/var/run/vsftpd #这选项指向一个空目录,并且ftp用户对此目录无写权限 pam_service_name=vsftpd #指明VSFTPD使用用PAM验证服务时的PAM配置文件名 rsa_cert_file=/etc/ssl/certs/vsftpd.pem #不知道 .^- guest_enable=YES #启动这项功能,所有的非匿名登入者都视为guest guest_username=iguest 定义VSFTPD的guest用户在系统中的用户名 |
msn@debian:/home$ ls -ld /home/ftp/ drwxr-xr-x 5 root root 1024 2006-07-26 17:22 /home/ftp/ |
debian:/etc/#mkdir /home/ftp/pub debian:/etc/#chmod 777 /home/ftp/pub debian:/etc/#ls -ld /home/ftp/pub/ drwxrwxrwx 4 msn nogroup 1024 2006-08-02 17:50 /home/ftp/pub/ |
debian:/etc/#apt-get install libpam-mysql |
debian:/etc/#mkdir /var/ftp debian:/etc/#useradd -d /var/ftp -s /bin/false iguest #增加iguest用户,主目录为/var/ftp,设置/bin/false不允许登录系统 debian:/etc/#chown iguest.nogroup /var/ftp #改变/var/ftp文件夹 |
debian:/etc/#mysql -uroot -p mysql>create database ftpd; mysql>use ftpd; mysql> create table user ( -> id int AUTO_INCREMENT NOT NULL, -> name char(20) binary NOT NULL, -> passwd char(50) binary NOT NULL, -> primary key(id) -> ); mysql> describe user; +--------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+----------+------+-----+---------+----------------+ | id | int(10) | | PRI | NULL | auto_increment | | name | char(20) | | | | | | passwd | char(50) | | | | | +--------+----------+------+-----+---------+----------------+ #增加用户 mysql>insert into user (name,passwd) values ('adsl','123456'); 让iguest能访问ftpd和表user: mysql>grant select on ftpd.user to iguest@localhost identified by '123456'; mysql>quit |
debian:/etc/# mysql -uiguest -p123456 ftpd |
auth required pam_mysql.so user=iguest passwd=123456 host=localhost db=ftpd table=user usercolumn=name passwdcolumn=passwd crypt=0 account required pam_mysql.so user=iguest passwd=123456 host=localhost db=ftpd table=user usercolumn=name passwdcolumn=passwd crypt=0 |
#/etc/init.d/vsftpd restart msn@debian:/home$ lftp adsl@localhost 口令: lftp adsl@localhost:~> ls -rw-r--r-- 1 0 0 0 Aug 03 02:12 test.txt |
vsftpd.conf 详细的说明在这里 |