1. 程式人生 > 實用技巧 >linux中部署vsftpd服務

linux中部署vsftpd服務

FTP:(File Transfer Protocal)檔案傳輸協議

vsftp:(very secure ftp daemon) 非常安全的FTP守護程序。

FTP:是一種在網際網路中進行檔案傳輸的協議。

FTP協議: 伺服器/客戶端模式

20埠用於資料傳輸,21埠接受客戶端的命令

FTP伺服器:按照FTP協議在網際網路中提供檔案儲存和訪問服務的主機。

FTP客戶端:向伺服器傳送連線請求,以建立資料傳輸鏈路的主機。

以下實驗中PC1作為伺服器,PC2作為客戶端。

1、 在PC1伺服器端安裝vsftp服務

[root@PC1 ~]# yum install vsftpd
Loaded plugins: langpacks, product
-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. rhel7 | 4.1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package vsftpd.x86_64 0
:3.0.2-9.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: vsftpd x86_64
3.0.2-9.el7 rhel7 166 k Transaction Summary ================================================================================ Install 1 Package Total download size: 166 k Installed size: 343 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : vsftpd-3.0.2-9.el7.x86_64 1/1 rhel7/productid | 1.6 kB 00:00 Verifying : vsftpd-3.0.2-9.el7.x86_64 1/1 Installed: vsftpd.x86_64 0:3.0.2-9.el7 Complete!

2、iptables防火牆預設禁止了FTP傳輸協議的埠號,在伺服器端PC1清空防火牆策略並儲存

[root@PC1 ~]# iptables -F
[root@PC1 ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

3、在PC1主機中精簡vsftpd服務的配置檔案

[root@PC1 ~]# cd /etc/vsftpd/
[root@PC1 vsftpd]# ls
ftpusers  user_list  vsftpd.conf  vsftpd_conf_migrate.sh
[root@PC1 vsftpd]# cp vsftpd.conf vsftpd.conf.bak
[root@PC1 vsftpd]# grep -v "#" vsftpd.conf > a && mv a vsftpd.conf
mv: overwrite ‘vsftpd.conf’? y
[root@PC1 vsftpd]# cat vsftpd.conf
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES