cd /usr/local/src/
wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.42.tar.bz2 (下载pureftp源码包)
tar jxvf pure-ftpd-1.0.42.tar.bz2 (解压)
cd pure-ftpd-1.0.42
./configure --prefix=/usr/local/pureftpd --without-inetd --with-altlog --with-puredb --with-throttling --with-peruserlimits --with-tls (按照这个编译参数进行编译)
make && make install
mkdir -p /usr/local/pureftpd/etc/ (创建pure配置文件存放位置文件夹)
cd configuration-file (移动到配置文件模板位置)
cp pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf (拷贝配置文件模板)
cp pure-config.pl /usr/local/pureftpd/sbin/pure-config.pl (拷贝启动文件)
chmod 755 /usr/local/pureftpd/sbin/pure-config.pl (更改启动文件权限)
vim /usr/local/pureftpd/etc/pure-ftpd.conf (编辑配置文件,如下)
VerboseLog no
DisplayDotFiles yes
AnonymousOnly no
NoAnonymous no
SyslogFacility ftp
DontResolve yes
MaxIdleTime 15
PureDB /usr/local/pureftpd/etc/pureftpd.pdb
LimitRecursion 3136 8
AnonymousCanCreateDirs no
MaxLoad 4
AntiWarez yes
Umask 133:022
MinUID 100
AllowUserFXP no
AllowAnonymousFXP no
ProhibitDotFilesWrite no
ProhibitDotFilesRead no
AutoRename no
AnonymousCantUpload no
PIDFile /usr/local/pureftpd/var/run/pure-ftpd.pid
MaxDiskUsage 99
CustomerProof yes
mkdir /data/ftp (创建fpt共享目录)
useradd ftpuser (添加ftp用户)
chown -R ftpuser:ftpuser /data/ftp (将ftp共享文件夹属主属组更改为刚才建立的用户)
/usr/local/pureftpd/bin/pure-pw useradd user -uftpuser -d /data/ftp/ (添加pureftp用户user)
/usr/local/pureftpd/bin/pure-pw mkdb (创建用户信息数据文件)
/usr/local/pureftpd/bin/pure-pw list (列出当前共享的文件夹及ftp用户)
/usr/local/pureftpd/bin/pure-pw userdel user (删除用户)
yum install -y lftp (需要安装lftp)
lftp user@192.168.111.129 (连接pureftp)
get 1.txt (下载)
put 2.txt (上传)
vsftp
yum install -y lftp (安装vsftp)
/etc/init.d/vsftpd start (开启vsftp服务,如果失败,有可能是端口被占用了)
vim /etc/vsftpd/vsftpd.conf (修改vsftp配置文件,去除红色的行注释)
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES
#chroot_list_enable=YES (是否开启访问用户表)
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list (访问用户表存放位置)
lftp user1@192.168.111.129 (远程访问ftp服务器)
配置vsftp虚拟用户服务
vim /etc/vsftpd/vsftpd_login (创建虚拟用户登录信息)
tset1
aaa111222
chmod 600 /etc/vsftpd/vsftpd_login (更改登录信息文件权限)
db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db (生成与该登录信息对应的库文件)
mkdir /etc/vsftpd/vsftpd_user_conf/ (创建虚拟用户配置文件目录)
cd /etc/vsftpd/vsftpd_user_conf (移动到该目录下)
vim test1 (编辑虚拟用户test1的配置文件)
cal_root=/home/virftp/test1
anonymous_enable=NO
write_enable=YES
local_umask=022
anon_upload_enable=NO
anon_mkdir_write_enable=NO
idle_session_timeout=600
data_connection_timeout=120
max_clients=10
max_per_ip=5
local_max_rate=50000
mkdir /home/virftp/test1 (创建ftp文件上传目录)
chown -R virftp:virftp /home/virftp (更改ftp目录的属主和属组)
vim /etc/pam.d/vsftpd (更改配置文件,添加如下两行,如果是64位系统则需改为/lib64/..)
auth sufficient /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account sufficient /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
vim /etc/vsftpd/vsftpd.conf (编辑主配置文件,关闭如下配置,并添加红色配置)
anonymous_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virftp
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/vsftpd_user_conf
/etc/init.d/vsftpd restart (重启生效)
原文地址:http://blog.51cto.com/culiangmianbao/2052346