centos-rhel服务器相关 / 未分类 · 2015年5月23日

FTP之proftp

第一章   proftpd之源码安装
下载 http://www.proftpd.org/
安装
tar xvf proftpd-1.3.4a.tar.bz2
cd proftpd-1.3.4a

./configure --prefix=/usr/local/proftpd
make ;make install

cd  /etc/init.d/
##自启动文件 也可以在这下载
proftpd
chmod +x proftpd
创建用户
#uid gid 要自己查看哦 这个比较不出错
ftpasswd --file=/etc/proftpd/ftpd.passwd --home=/home/xxxx \
--shell=/bin/false --name=xxxx \
--uid=1111 --gid=1111 --passwd

##创建用户 前提系统必有 www 用户
echo '123456' | /usr/local/proftpd/bin/ftpasswd --passwd --file=/usr/local/proftpd/etc/passwd --name=evan --uid=$(cat /etc/passwd |grep www |awk -F : '{print $3}') --gid=$(cat /etc/passwd |grep www |awk -F : '{print $3}') --home=/data/www/frg_act_91 --shell=/sbin/nologin --stdin
[root@appjoys_WEB proftpd]# cat /etc/passwd | grep www
www:x:507:507::/data/www:/bin/bash
##先useradd 一个(/sbin/nologin), ftp设置时新加的用户 UID GID设置成与 www一样就行了呢,因为 要给对方 用的目录是 www 所有
还是这个好最好还是指定 uid and gid 因为 有时 cat 出来的不唯一
echo '123456' | /usr/local/proftpd/bin/ftpasswd --passwd --file=/usr/local/proftpd/etc/passwd --name=evan --uid=507 --gid=507 --home=/data/www/frg_act --shell=/sbin/nologin --stdin
mkdir -p /data/www/frg_act_91
chown -R www:www /data/www/frg_act_91
vim /usr/local/proftpd/etc/proftpd.conf
####配置文件##
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName “ProFTPD Default Installation”
ServerType standalone
DefaultServer on
DefaultAddress 27.131.221.154
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30
# Set the user and group under which the server will run.
User www
Group www
# To cause every FTP user to be “jailed” (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Bar use of SITE CHMOD by default
DenyAll
# modified by Micheas Liao
AuthOrder mod_auth_file.c
AuthUserFile /usr/local/proftpd/etc/passwd
ServerIdent off
DeferWelcome off
TimesGMT off
UseReverseDNS off
Identlookups off
RequireValidShell off
WtmpLog off
AllowOverride off
SystemLog /var/log/proftpd.log
AllowUser act_frg act_frg_kaixin001 evan #  要注意 有这个
DenyAll
AllowAll evan act_frg  # 要注意 有这个
AllowAll
最后启动
/etc/init.d/proftpd start
********************
问题
安装好后提示error: no valid servers configured
# /etc/init.d/proftpd start
Starting proftpd: – warning: unable to determine IP address of ‘frg_xiaonei’
– error: no valid servers configured
Fatal: error processing configuration file ‘/usr/local/proftpd/etc/proftpd.conf’
解决方法如下:
在proftp.conf 配置文件里面添加下面一个信息
DefaultAddress 本机ip # 添加服务器IP绑定
 
几个要注意的地方
设置密码时 用户与密码要一致
配置文件 要记得 AllowUser ,and AllowAll 重启服务
<Limit LOGIN>
AllowUser 登录的所有用户名
DenyAll
</Limit>
503 错误,忘记allow
更新于20120913pm
以下文章也不错
http://os.chinaunix.net/a2012/0210/1310/000001310140.shtml