Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

centos8上的ftp传输服务和设置[0]

Posted on 2023年11月14日 by

之前没有考虑到ftp的用途,鉴于需要部署自动脚本,因此需要下载源码,但是网络不行,导致有些下载特别慢,因此可以采用wget和ftp结合的的方式进行。

因此ftp的部署基本上相当于部署源码下载器(开源同步器)

  • FTP简介

FTP传输模式

文件传输协议(File Transfer Protocol,FTP),基于该协议FTP客户端与服务端可以实现共享文件、上传文件、下载文件。
FTP基于C/S模式,FTP客户端与服务器端有两种传输模式,分别是FTP主动模式、FTP被动模式。主被动模式均是以FTP服务器端为参照。

FTP主动模式:客户端从一个任意的端口N(N>1024)连接到FTP服务器的port 21命令端口,客户端开始监听端口N+1,并发送FTP命令“port N+1”到FTP服务器,FTP服务器以数据端口(20)连接到客户端指定的数据端口(N+1)

FTP被动模式:客户端从一个任意的端口N(N>1024)连接到FTP服务器的port 21命令端口,客户端开始监听端口N+1,客户端提交 PASV命令,服务器会开启一个任意的端口(P >1024),并发送PORT P命令给客户端。客户端发起从本地端口N+1到服务器的端口P的连接用来传送数据

  • 部署ftp

此处的ftp服务有个两作用,在一台vps上部署ftp服务器,由本地进行文件上传。另外就是两台vps服务器间的ftp传输。

安装环境centos8 x64 vsftp3.0.3

ftp服务端程序vsftpd,用于上传文件

1)软件包安装

systemctl stop firewalld 
yum install vsftpd -y 
rm /etc/vsftpd/vsftpd.conf 
nano /etc/vsftpd/vsftpd.conf

2)修改配置:

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
listen_port=6069
pasv_enable=YES
pasv_min_port=51000
pasv_max_port=52000

3)防火墙设置

systemctl restart firewalld
firewall-cmd --permanent --zone=public --add-port=6069/tcp
firewall-cmd --permanent --zone=public --add-port=51000-52000/tcp 
systemctl restart firewalld

4)重启系统服务

systemctl restart vsftpd
systemctl status vsftpd
systemctl enable vsftpd

windows下的客户端程序FileZilla-3.50.0

ftp客户端程序,用于从ftp文件服务器下载文件

安装ftp客户端

yum install ftp -y
#登录ftp
ftp 149.248.14.160
#提示输入用户名和密码
#ftp中下载远程文件
ftp>get file
#完成后道当前目录去查找
#退出ftp
ftp>exit

5)本地账户允许ftp登录,但是禁止ssh登录

用于保护vps的安全

useradd newftpuser
#创建一个shell外壳
echo -e '#!/bin/sh\necho "This account is limited to FTP access only."' | tee -a  /bin/ftponly
#注册shell
echo "/bin/ftponly" >> /etc/shells
#将用户移到采用此外壳登录
usermod newftpuser -s /bin/ftponly

效果:

 

参考资料:

  1. https://www.linuxprobe.com/chapter-11.html
  2. https://www.cnblogs.com/Sungeek/p/10148656.html
  3. https://blog.csdn.net/axing2015/article/details/83187315
  4. https://www.cnblogs.com/weafer/archive/2011/06/13/2079509.html
  5. http://blog.nanshengbbs.top/2020/05/28/Vsftp%E5%AE%89%E8%A3%85%E4%B8%8E%E9%85%8D%E7%BD%AE/
  6. https://www.myfreax.com/how-to-setup-ftp-server-with-vsftpd-on-centos-8/

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT