proftpd学习配置笔记

一、软件下载
proftpd-1.3.0rc3.tar.gz
官方网站: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 /]# groupadd ftpusers # 增加一个ftpusers组
 
[root@localhost /]# useradd -d /tools -g ftpusers -s /sbin/nologin softsoul 
# 在ftpusers组增加一个名为softsoul的用户,目录设定为/tools,软件上传专用
 
[root@localhost /]# useradd -d /var/www/html -g ftpusers -s /sbin/nologin websoul # 在ftpusers组增加一个名为websoul的用户,目录设定为/var/www/html,WEB server专用
2、建立上传目录
# 如果你已经配置好WEB server,/var/www/html目录已经存在,只需如下修改目录权限(也可以在GUI界面下操作)
 
[root@localhost /]# chgrp -R ftpusers /var/www/html  # 把wwwroot的归属组改为 ftpusers 组
 
[root@localhost /]# chmod -R 775 /var/www/html # 设置权限,ftpusers组对该文件夹具有读写执行的权限,其他用户只有读、执行权限(不可没有执行权限,否则web浏览不了)
 
[root@localhost /]# mkdir tools #在根目录下建立tools目录,作为软件目录
 
[root@localhost /]# chgrp -R ftpusers tools # 把tools的归属组也改为 ftpusers 组
 
[root@localhost /]# chmod -R 775 /tools # 设置权限

三、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            "Soul's 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 limit maximum number of processes per service
# (such as xinetd).
MaxInstances            30 # 最多有30个proftpd的PID

MaxHostsPerUser 1 "Sorry, you may not connect more than one time" # 每个IP只允许一个连接
MaxClientsPerUser 1 "Only one such user at a time" # 每个帐户在每个客户端最多可以同时登陆1次
MaxClientsPerHost 1 "Sorry, you may not connect more than one time" # 同一个客户端只能最多1个帐号可以登陆

# Set the user and group under which the server will run.
User                nobody
Group                nobody

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~ ftpuser  # 限制ftpusers组的用户在自己的目录下

# Normally, we want files to be overwriteable.
AllowOverwrite        on # 是否允许覆盖

# Bar use of SITE CHMOD by default
 <Limit SITE_CHMOD>
  DenyAll
 </Limit>

# 设置只有ftpusers组的用户可以ftp登录
<limit LOGIN>
DenyALL
AllowGroup ftpuser
</limit>

# 设置帐号websoul拥有/var/www/html目录的所有权限
<directory /var/www/html>
<Limit all>
AllowUser websoul
 </Limit>
</directory>

# 设置帐号softsoul拥有/tools目录的所有权限
<directory /tools>
<Limit all>
AllowUser softsoul
 </Limit>
</directory>

# Limit the maximum number of anonymous logins
  MaxClients            10 # 最多允许10个用户在线

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin            welcome.msg # 当使用者登录时,则会显示 welcome.msg 中的欢迎词信息
  DisplayFirstChdir        .message # 当使用者转换目录,则会显示 .message 中的信息
##(上面的欢迎信息我测试后好象不成功,郁闷中,,,,,)

ServerIdent off # 屏蔽服务器版本信息
MaxLoginAttempts 3 # 最大连接次数
WtmpLog on # 是否要把ftp记录在日志中,如果不想可以设置成off屏蔽掉log日志。
TimeoutIdle 600 # 客户端idel时间设置,默认就是600秒

AllowRetrieveRestart on # 下载时,允许断点续传(默认已有,可不设置)
AllowStoreRestart on # 上传时,允许断点续传

# 让proftp支持现在流行的FXP传输方式,默认是不支持的。
AllowForeignAddress on
PassivePorts 49152 65534 # 端口也可自己指定喜欢的


 # 下面是关于匿名用户的相关配置,根据需要自己设定,因为我不需要匿名用户登录,所以全部屏敝掉了


# A basic anonymous configuration, no upload directories.  If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
# <Anonymous ~ftp>
# 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            10

  # 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
 # <Limit WRITE>
  #  DenyAll
 # </Limit>
# </Anonymous>

四、开机自动运行proftpd
 # 若需要将proftpd设置为系统启动时自动启动则通过如下命令拷贝启动文件:

[root@proftpd-1.3.0rc3]# 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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值