荣耀之链论坛

 找回密码
 立即注册
搜索
查看: 2212|回复: 3

centos7 搭建FTP服务器

[复制链接]

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
发表于 2018-5-4 02:32 | 显示全部楼层 |阅读模式

https://blog.csdn.net/luckyzsion/article/details/75371188
https://jingyan.baidu.com/article/870c6fc3754ec1b03fe4bec4.html

参考这两个教程




我自己的过程如下:
yum install -y vsftpd

vi /etc/vsftpd/vsftpd.conf

anonymous_enable=NO  #禁止匿名
local_enable=YES  #允许本地账户

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list #这里要手动建立这个文件,里面留空或者填none   为了安全,这3个必须开启

allow_writeable_chroot=YES #这个是在最下面添加一行,应该是允许用户写入


新建FTP用户
useradd -d /home/ftp -g ftp -s /sbin/nologin ftpusername  #这个命令的意思是新建一个不能用来登录的用户ftpusername,属于ftp组,用户的主目录是/home/ftp  如果目录已经存在会报警,但是不影响使用
passwd ftpusername  #给这个用户设置密码
chown -R ftpusername.ftp /home/ftp   #更改这个目录的所有权


最后启动服务
service vsftpd start
回复

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2018-5-4 02:58 | 显示全部楼层
https://www.cnblogs.com/daemonlu/p/8982894.html
一个教程,关于主动模式被动模式的

还有限速相关
回复 支持 反对

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2023-1-16 18:20 | 显示全部楼层
阿里云ecs搭建VSFTP由于是内网IP  还必须使用pasv模式
  1. chroot_local_user=YES
  2. #chroot_list_enable=YES
  3. # (default follows)
  4. #chroot_list_file=/etc/vsftpd/chroot_list
  5. #
  6. # You may activate the "-R" option to the builtin ls. This is disabled by
  7. # default to avoid remote users being able to cause excessive I/O on large
  8. # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
  9. # the presence of the "-R" option, so there is a strong case for enabling it.
  10. #ls_recurse_enable=YES
  11. #
  12. # When "listen" directive is enabled, vsftpd runs in standalone mode and
  13. # listens on IPv4 sockets. This directive cannot be used in conjunction
  14. # with the listen_ipv6 directive.
  15. listen=YES
  16. #
  17. # This directive enables listening on IPv6 sockets. By default, listening
  18. # on the IPv6 "any" address (::) will accept connections from both IPv6
  19. # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
  20. # sockets. If you want that (perhaps because you want to listen on specific
  21. # addresses) then you must run two copies of vsftpd with two configuration
  22. # files.
  23. # Make sure, that one of the listen options is commented !!
  24. #listen_ipv6=YES

  25. pam_service_name=vsftpd
  26. userlist_enable=YES
  27. #tcp_wrappers=YES
  28. allow_writeable_chroot=YES


  29. #pasv_enable=YES
  30. #pasv_addr_resolve=YES
  31. pasv_address=116.62.0.0 #这里填IP 不需要双引号
  32. pasv_min_port=10050
  33. pasv_max_port=10060  #防火墙要放行21 20  和这个端口范围
复制代码

刚刚搭建的时候用户直接用useradd添加就行 不知道为什么 按照一楼的教程添加一个不能登录的用户 始终提示密码不对

回复 支持 反对

使用道具 举报

1326

主题

2373

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
10267
 楼主| 发表于 2023-7-2 21:12 | 显示全部楼层
这个教程作废了,直接用docker搭建FTP吧 简单省事
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

荣耀之链

GMT+8, 2025-6-18 03:26 , Processed in 0.014626 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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