FTP服务器匿名用户也能上传文件的配置

环境:
  
  RedHat 7.3 wu-ftp-2.6.2 proftpd-1.2.4
  
  步骤:
  
  1.wu-ftp
  
  a.从RedHat的光盘上安装wu-ftpd-2.6.2-5.i386.rpm和anonftp-4.0-9.i386.rpm这两个包
  
  # rpm -ivh anonftp-4.0-9.i386.rpm wu-ftpd-2.6.2-5.i386.rpm
  
  b.创建目录incoming作为上传目录
  
  # mkdir /var/ftp/incoming
  
  c.创建ftp文件管理员,这个用户拥有对所有上传文件的管理权限,这个用户不应该是root和匿名ftp用户的帐号.我这里用ftpadmin:
  
  # groupadd -g 96 ftpadmin
  
  # useradd -g 96 -u 96 -s /sbin/nologin -d /var/ftp/ ftpadmin
  
  d.修改incoming目录的属主和权限:
  
  # chown ftpadmin /var/ftp/incoming
  
  # chgrp ftpadmin /var/ftp/incoming
  
  # chmod 3773 /var/ftp/incoming(匿名用户是不可以从incoming目录下载文件的,所以这个目录的属性是3写和执行)
  
  e.修改/etc/ftpaccess文件,允许上传文件.在这个文件中加入一下几行:
  
  upload /var/ftp /incoming yes ftpadmin ftpadmin 0440 nodirs
  
  这句话的意思是说/var/ftp目录下的incoming目录允许上传文件,文件的所有者是ftpadmin,组所有者是ftpadmin,文件上传后的属性是0440,不允许创建目录,如果允许创建目录就把nodirs改成dirs,更多的说明请使用man ftpaccess
  
  f.修改/etc/xinetd.d/wu-ftp,把disable=yes改为disable=no然后重新启动xinetd进程
  
  # /etc/initd./xinetd restart
  
  g.自己测试一下吧:
  
  # ftp 127.0.0.1
  Connected to 127.0.0.1.
  220 ns2.catv.net FTP server (Version wu-2.6.2-5) ready.
  504 AUTH GSSAPI not supported.
  504 AUTH KERBEROS_V4 not supported.
  KERBEROS_V4 rejected as an authentication type
  Name (127.0.0.1:root): ftp
  331 Guest login ok, send your complete e-mail address as password.
  Password:
  230-The response '' is not valid
  230-Next time please use your e-mail address as your password
  230- for example: joe@localhost.localdomain
  230 Guest login ok, access restrictions apply.
  Remote system type is UNIX.
  Using binary mode to transfer files.
  ftp>cd incoming
  ftp>put vpopmai.tar.gz
  local: vpopmai.tar.gz remote: vpopmai.tar.gz
  227 Entering Passive Mode (127,0,0,1,134,83)
  150 Opening BINARY mode data connection for vpopmai.tar.gz.
  226 Transfer complete.
  273353 bytes sent in 0.032 seconds (8.3e+03 Kbytes/s)
  ftp> bye

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwwffw.html