How to realize file transfer between Linux system and Windows system

1. The concept of FTP

  • FTP service-protocol used to transfer files
  • FTP is a software for uploading and downloading. Users can connect their PC to a server running FTP protocol through it, and access the programs and information on the server
  • Like most Internet services, FTP is also a client/server system. The user issues commands to the server program through the client program, and the server program executes the commands issued by the user and returns the execution results to the client.
  • FTP server uses TCP protocol by default20、21Port for communication
    (Port 20 is used to establish a data connection and transfer file data, port 21 is used to establish a control connection and transfer FTP control commands
  • FTP data connection can be divided intoActive mode(The server actively initiates a data connection) andPassive mode(The server passively waits for data connection)

2. Operation process

Mount the image before startingInsert picture description here

2.1 Install the software package, backup files

yum install -y vsftpd              #安装软件vsftpd
cd /etc/vsftpd/                    #切换到/etc/vsftpd目录下,配置文件为/etc/vsftpd/vsftpd.conf
cp vsftpd.conf vsftpd.conf.bak     #修改配置文件之前先备份,它没有模板

Insert picture description here
Insert picture description here

2.2 Modify the configuration file

vim /etc/vsftpd/vsftpd.conf        #修改配置文件
anonymous_enable=YES               #开启匿名用户访问,默认已开启
write_enable=YES                   #开放服务器的写权限(若要上传,必须开启),默认已开启
anon_umask=022                     #设置匿名用户所上传数据的权限掩码(反掩码),默认已开启
anon_upload_enable=YES             #允许匿名用户上传文件,默认已注释,需取消注释
anon_mkdir_write_enable=YES        #允许匿名用户创建(上传)目录。默认已注释,需取消注释
anon_other_write_enable =YES       #允许删除、重命名、覆盖等操作,需添加

Insert picture description here
Insert picture description here

2.3 Empowerment

chmod 777 /var/ftp/pub       #为匿名访问ftp的根目录下的 pub子目录设置最大权限,以便匿名用户上传数据

Insert picture description here

2.4 Turn on FTP service, turn off firewall and security mechanism

systemctl start vsftpd          #开启服务
systemctl stop firewalld        #关闭防火墙
setenforce 0                    #关闭系统安全机

Insert picture description here

2.5 Anonymous access test

Insert picture description here
windows 10:

ftp 192.168.184.10              #建立ftp连接
ftp> pwd			            #匿名访问ftp的根目录为Linux系统的/var/ftp/目录
ftp> ls				            #查看当前目录
ftp> cd pub		     			#切换到pub 目录
ftp> get 文件名					#下载文件到当前Windows本地目录
ftp> put 文件名					#上传文件到ftp目录
ftp> quit						#退出

Insert picture description here
Insert picture description here
Insert picture description here
 45
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_51613313/article/details/110637355