设为首页 收藏本站
查看: 312|回复: 0

[经验分享] proftpd的搭建以及相关配置

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-9-19 09:05:13 | 显示全部楼层 |阅读模式
配置文件在etc/proftpd.conf,配置文件说明如下:

ServerName                     "ProFTPD Default Installation"
ServerType                     standalone
DefaultServer                  on

分别表示:服务器名称,服务类型和默认服务状态!

后面的服务端口啊什么的我就省去不说了,说最关键的权限控制部分。

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

注意看上面:以什么用户和什么组来运行服务。

更改为你现有的组和用户,这里为了管理上的方便和安全性上考虑,建议新建一个ftp组和ftp用户。

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#DefaultRoot ~
是否允许用户进入用户的主目录,注意:可是适用/home替代

# Normally, we want files to be overwriteable.
AllowOverwrite         on
是否具有重写的权利

# 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>

这部分是匿名用户的定义其实也很简单。

------------------------------------------------

启动不了,出现如下错误的解决方法

[iyunv@new-host sbin]# ./proftpd
- IPv4 getaddrinfo 'new-host' error: Name or service not known
- warning: unable to determine IP address of 'new-host'
- error: no valid servers configured
- Fatal: error processing configuration file '/usr/local/proftpd/etc/proftpd.conf'

原因是无法绑定Ip地址。

在配置文件中增加下面这句:

DefaultAddress                 192.168.8.105
再重启服务就可以了!



对出现的530 Login incorrect错误,查看日志发现Invalid shell错误
在配置中添加

RequireValidShell             off


"Fatal: Socket operation on non-socket"
  这通常意味着在 proftpd.conf 配置文件中 ServerType 指令被配置成 inetd
  (超级服务器)方式而不是 standalone(独立服务器) 方式来运行。



PROFTPD服务器相关命令

  1、ftpshut:关闭FTP服务,并在/etc下生成文件shutmsg。要重新开放FTP服务,把/etc/shutmsg删除。
  2、ftpcout:FTP服务器在线人数信息显示。
  3、ftpwho:FTP服务器在线人员名单。

几个文件的功能及路径
/usr/local/sbin/proftpd 执行程序
/usr/local/etc/proftpd.conf 设置文件
/usr/local/var/proftpd.pid proftpd做为一个服务的ID号


设定proftpd.conf文件,起动服务

cd /etc/rc.d/rc3.d
ln -s /usr/local/sbin/proftpd S99proftpd

或者
修改/etc/rc.d/rc.local
加上下面这句
/usr/local/sbin/proftpd start

proftpd 怎么查看在线连接的ip

登陆服务器
输入 ftpwho
或ftptop
ftptop可以显示在线人的ip 速度等


//////////////////////////////////////////////////////
ProFTPD configuration



先建立ftp和media用户,用户组为nogroup,不允许登录系统

useradd media -d/home/media -gnogroup

增加权限

chown -R media /hoem/media

要使ftp用户登录要修改/etc/ftpuser文件注释掉ftp



内网架设FTP服务器的方法:
1. 在proftpd.conf中利用MasqueradeAddress命令将网关的IP地址或域名指定给FTP服务器,例如
MasqueradeAddress myftpserver.vicp.net   ?????
或MasqueradeAddress 12.34.56.78          ?????经使用只能连接不能下载
然后通过PassivePorts命令来限制被动方式下监听的端口的范围,例如
PassivePorts 60000 65534
2. 在网关的端口映射上将第一步中指定的端口范围(例中为60000-65534)以及FTP端口21映射到FTP服务器的内网地址上。

getaddrinfo 'test' error: Name or service not known
- warning: unable to determine IP address of 'test'
- error: no valid servers configured
- Fatal: error processing configuration file '/etc/proftpd.conf'
解决:产生该问题是由于hosts文件里机器名未增加别名引起的。
#vi /etc/host



proftpd登陆速度慢的问题的解决

proftpd.conf中增加两行设置:
UseReverseDNS off
IdentLookups off




# This is a basic ProFTPD configuration file.
# It establishes a single server and a single anonymous login.
# It assumes that you have a user/group "nobody" and "ftp"
# for normal/anonymous operation.

ServerName   "ProFTPD Default Installation"
ServerType   standalone
#ServerType   inetd
DefaultServer   on

UseReverseDNS off
IdentLookups off

# 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 that the server normally runs at.
User  ftp
# nobody
Group  nogroup
# nogroup
# This next option is required for NIS or NIS+ to work properly:
#PersistentPasswd off

SystemLog   /var/log/proftpd.log
TransferLog   /var/log/xferlog

DefaultAddress  192.168.1.254
# Normally, we want files to be overwriteable.
<Directory /*>
  AllowOverwrite  on
</Directory>

<Anonymous ~media>
  RequireValidShell  off
  User   media
  Group         nogroup
  MaxClients   50
  DisplayLogin   welcome.msg
  DisplayFirstChdir  .message
<Directory /*>
  <Limit All>
    AllowAll
  </Limit>
</Directory>
</Anonymous>
# A basic anonymous FTP server configuration.
# To enable this, remove the user ftp from /etc/ftpusers.
<Anonymous ~ftp>
  RequireValidShell  off
  User   ftp
  Group         nogroup
  # 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   50

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin   welcome.msg
  DisplayFirstChdir  .message


  # An upload directory that allows storing files but not retrieving
  # or creating directories.
  <Directory /*>
    <Limit READ>
      AllowAll
    </Limit>

  # Limit WRITE everywhere in the anonymous chroot
  <Limit WRITE>
  AllowAll
  </Limit>
    <Limit STOR>
      AllowAll
    </Limit>
  </Directory>

</Anonymous>

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-25064-1-1.html 上篇帖子: centos默认python2.6升级2.7 下篇帖子: tar命令——将文件/目录压缩到指定目录
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表