Proftp安装及配置(完整版)

Proftp安装及配置(完整版)

 

一、软件下载
proftpd-1.3.1rc3.tar.bz2    1.5 M
proftpd-1.3.1rc3.tar.gz    2.0 M
官方网站: http://www.proftpd.org/
镜像站点: http://www.proftpd.de/
二、解压缩、编译安装
# 解压缩
[root@localhost /]# tar zvxf proftpd-1.3.0rc3.tar.gz
[root@localhost /]#cd proftpd-1.3.0rc3
#编译安装(安装到/usr/local/proftpd目录下,可随意改变此目录)
[root@localhost proftpd-1.3.0rc3]# ./configure --prefix=/usr/local/proftpd
[root@localhost proftpd-1.3.0rc3]# make 
[root@localhost proftpd-1.3.0rc3]# make install
三、建立FTP用户及相关权限(此处可根据实际需要配置)
1、建立用户
[root@localhost /]#useradd -s /sbin/nologin -d /tools USERNAME
[root@localhost /]#passwd USERNAME
四、FTP server配置
# 如果是和偶一样的菜鸟,建议在GUI界面下用gedit打开/usr/local/proftpd/etc/proftpd.conf进行配置,配置之前建议做好备份
[root@localhost /]# vi /usr/local/proftpd/etc/proftpd.conf
# 以下是偶的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 "FTP Server"
ServerType standalone
DefaultServer on
#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&! nbsp;limit maximum number of processes per&nb sp;service # (such as xinetd)
MaxInstances 30
RequireValidShell off
ServerIdent off
UseReverseDNS off
IdentLookups off
WtmpLog off
TimeoutStalled 100
MaxClients 30
MaxClientsPerHost 5 "everyone only use five connection"
DisplayLogin welcome.msg
TransferLog /var/log/ftp_transferlog
#SystemLog /var/log/ftp_syslog
# Set the user and group that the server normally runs at.
User nobody
Group nobody
#add support FXP
#AllowForeignAddress on
#add passive mode
#PassivePorts 49152 65534

RootLogin off
#DefaultRoot ~ !root
# Normally, we want files to be overwriteable.

AllowOverwrite on
AllowRetrieveRestart on
AllowStoreRestart     on
# A basic anonymous configuration, no upload directories.
#
#User ftp
#Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
#UserAlias anonymous ftp
# Limit the maximum number of anonymous logins
#MaxClients 500
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
#DisplayLogin welcome.msg
#DisplayFirstChdir .message
# Limit WRITE everywhere in the anonymous chroot
#
#DenyAll
#
#TransferRate RETR 50
#TransferRate STOR 100
#
DefaultRoot ~

五、开机自动运行proftpd
# 若需要将proftpd设置为系统启动时自动启动则通过如下命令拷贝启动文件:
[[email protected]]# cp ./contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
# 修改该脚本的可执行属性:
[root@localhost /]# chmod +x /etc/rc.d/init.d/proftpd
**********看网上有的文章为以下内容,大家可以参考****************************
然后编辑/etc/rc.d/init.d/functions:
修改
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"

export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin"
注:若将在运行./cofigure命令时通过--prefix选项指定将proftpd安装在/usr/sbin目录下则不需要修改fuctions文件。
***************************************************************************
====这段内容是我根据自己的实际情况修改的内容,与上面一段二者选一,大家试一下吧===
编辑/etc/rc.d/init.d/proftpd
修改
PATH="$PATH:/usr/local/sbin"

PATH="$PATH:/usr/local/proftpd/sbin"
======================================================================================

# 然后运行命令:
[root@localhost /]# chkconfig --level 35 proftpd on
# 则下次系统启动以后,proftpd将自动启动。

# 通过如下命令启动proftpd:
[root@ftpd /]# /etc/rc.d/init.d/proftpd start
这时候可以通过如下命令来测试proftpd是否正常运行:
[root@homeserver usr]# ftp 192.168.1.20
Connected to 192.168.1.20.
220 192.168.1.20 FTP server ready
500 AUTH not understood
500 AUTH not understood
KERBEROS_V4 rejected as an authentication type
Name (192.168.1.20:phoebus): softsoul
331 Password required for softsoul.
Password:
230 User softsoul logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>


六、配置实例,及参数详解
安装配置一个proftpd,达到以下要求
1 不允许匿名访问。
2 开放一个帐号test,只有在upload目录有上传权限,可以续传,不能改名和删除。
# tar zxvf proftpd-1.3.1rc3.tar.gz //解压
# cd proftpd-1.3.1rc3
# ./configure --prefix=/usr/local/proftpd --mandir=/usr/share/man --enable-static
# make
# make install
3 新建ftp专用帐号
# groupadd testftp
# useradd test  -g testftp -d /var/ftp
# passwd test
# mkdir /var/ftp
# chown test.testftp /var/ftp
# mkdir /var/ftp/upload
4 设置proftpd
# vi /usr/local/proftpd/etc/proftpd.conf
####具体配置如下######
ServerName                      "Test ftp server..."
ServerType                      standalone
DefaultServer                   on
#端口
Port                            21
Umask                           022
#最大线程数
MaxInstances                    30
User                            test
Group                           testftp
#DNS反查
UseReverseDNS off
IdentLookups off
#最大尝试连接次数
MaxLoginAttempts 3
#每用户线程
MaxClientsPerHost 2
#最大用户数
MaxClients 20
DirFakeUser On test
DirFakeGroup On testftp
DeferWelcome On
#日志文件位置
SystemLog /var/log/proftpd.log
ServerIdent off
#限制testftp组的test用户登录时不能切换到其他目录(只能呆在他的home目录)
DefaultRoot ~ test,testtftp
#设置只允许192.168.0的用户登录
#;
#Order allow,deny
#Allow from 192.168.0.
#Deny from all
#
;
#设置只允许test用户登录,否则系统用户也可以登录ftp
#;
#Order allow,deny
#DenyUser !test
#
;

#开起全盘的写权限

AllowOverwrite                on
AllowStoreRestart             on

AllowAll

#设置ycent用户在upload的限制
#DELE删除权限
#RNFR RNTO重命名权限
#RMD XRMD移动目录权限
;
;
DenyUser !test
;
;
#####结束######

你可能感兴趣的:(linux)