CentOS7搭建FTP服务器和安装FTP客户端

1,427次阅读
没有评论

一、概述

 项目需要搭建文件FTP服务器,基于Centos7搭建FTP服务器,同样再CentOS另外一台服务器安装FTP客户端,测试服务端的大家情况;其他就不多说了,介绍下大家流程,FTP服务器端用的软件版本:version 3.0.2;FTP服务端分为主动模式和被动模式;主动模式,就是客户端提供端口,ftp服务端连接客户端提供的端口,实现数据推送;被动模式,ftp服务器提供端口给客户端,客户端主动连ftp服务器;

二、FTP服务器安装

1.1、安装vsftpd

yum -y install vsftpd

1.2、修改配置文件
按照下面修改配置文件

cd /etc/vsftpd
vim vsftpd.conf

配置文件:

# 禁用匿名模式
anonymous_enable=NO
#
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
#具有写权限
write_enable=YES
#
#本地用户创建文件或目录的掩码
local_umask=022
# Activate directory messages - messages given to remote users when they
dirmessage_enable=YES
#
#当设定为YES时,使用者上传与下载日志都会被纪录起来。记录日志与下一个xferlog_file设定选项有关
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file=/var/log/xferlog # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES #chown_uploads=YES #chown_username=whoever #idle_session_timeout=600 # #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # async_abor_enable=YES # # ASCII mangling is a horrible feature of the protocol. ascii_upload_enable=NO ascii_download_enable=NO # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of chroot_local_user=YES chroot_list_enable=YES # (default follows)-该文件记得要有相应用户读写权限 chroot_list_file=/etc/vsftpd/chroot_list #chroot_list_file=/data/ftp/ #ls_recurse_enable=YES # #listen=NO # # Make sure, that one of the listen options is commented !! #listen_ipv6=YES
pam_service_name=vsftpd userlist_enable=NO tcp_wrappers=YES allow_writeable_chroot=YES listen_port=8887 #FTP访问目录 local_root=/data/ftp/
#被动模
pasv_enable=YES #被动模式对外提供端口 pasv_min_port=65400 pasv_max_port=65410

1.3、新建用户和赋值权限

#新建用户
useradd ftptrm -s /sbin/nologin -d /data/ftp
#修改密码
passwd ftptrm
#修改权限 chown -R ftptrm /data/ftp
chmod o+w ftptrm /data/ftp
#修改用户
echo 'ftptrm' >> /etc/vsftpd/user_list
cp /etc/vsftpd/user_list /etc/vsftpd/chroot_list

#服务器的selinux被禁用

 vim /etc/pam.d/vsftpd
 注释掉如下内容
 #auth required pam_shells.so

1.4、防火墙关闭(对外提供端口8887、65400-65410

systemctl stop firewalld
firewall-cmd --permanent --zone=public --add-port=8887/tcp
firewall-cmd --permanent --zone=public --add-port=65400-65410/tcp
firewall-cmd --reload #重新加载
firewall-cmd --zone=public --list-port #参考开发端口
#firewall-cmd --permanent --zone=public --remove-port=8886/tcp #禁用端口

1.5、启动服务

#开机启动
systemctl enable vsftpd.service
#重启服务
systemctl restart  vsftpd.service 
#启动
systemctl start  vsftpd.service 
#停止
systemctl stop  vsftpd.service 
#状态
systemctl status  vsftpd.service

三、FTP客户端安装

ftp安装

yum -y install ftp

客户端连接命令

#连接 IP 端口
ftp 192.168.1.100 8887
#输入名称
ftp>name
#密码
ftp>password
#进入目录
ftp>cd /data/ftp
#下载本地
ftp>get test.txt
#文件上传
ftp>put myfile /data/ftp/

530 Permission denied。
vsftpd.ftpusers:位于/etc/vsftpd目录下。它指定了哪些用户账户不能访问FTP服务器,例如root等。

 553 Could not create file.

赋值文件夹的权限:chmod -R 777

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2024 年 6 月
 12
3456789
10111213141516
17181920212223
24252627282930
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026 Jay 2025-12-22 09...
面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25 鹭羽 2025-12-13 22:37...
5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级 思邈 2025-12-10 14:28:37 来源:量子位 让更大规...
钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议 梦晨 2025-12-11 15:33:51 来源:量子位 A...
商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1 十三 2025-12-15 14:13:14 ...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
读懂2025中国AI走向!公司×产品×人物×方案,最值得关注的都在这里了

读懂2025中国AI走向!公司×产品×人物×方案,最值得关注的都在这里了

读懂2025中国AI走向!公司×产品×人物×方案,最值得关注的都在这里了 衡宇 2025-12-10 12:3...
5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级 思邈 2025-12-10 14:28:37 来源:量子位 让更大规...
戴尔 x OpenCSG,推出⾯向智能初创企业的⼀体化 IT 基础架构解决方案

戴尔 x OpenCSG,推出⾯向智能初创企业的⼀体化 IT 基础架构解决方案

戴尔 x OpenCSG,推出⾯向智能初创企业的⼀体化 IT 基础架构解决方案 十三 2025-12-10 1...
九章云极独揽量子位三项大奖:以“一度算力”重构AI基础设施云格局

九章云极独揽量子位三项大奖:以“一度算力”重构AI基础设施云格局

九章云极独揽量子位三项大奖:以“一度算力”重构AI基础设施云格局 量子位的朋友们 2025-12-10 18:...
乐奇Rokid这一年,一路狂飙不回头

乐奇Rokid这一年,一路狂飙不回头

乐奇Rokid这一年,一路狂飙不回头 梦瑶 2025-12-10 20:41:15 来源:量子位 梦瑶 发自 ...