vsftpd 安裝

vsftpd 安裝

這裏有最簡潔的安裝步驟html

理想流程

[root@itdragon ~]# useradd ftpuser
[root@itdragon ~]# passwd ftpuser
Changing password for user ftpuser.
New password: 
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@itdragon ~]# yum -y install vsftpd
[root@itdragon ~]# ifconfig

第一步:添加ftp用戶
第二步:設置ftp用戶密碼
第三步:安裝vsftpd
第四步:查看ip地址
第五步:本地使用免費的FileZilla 連接虛擬機linux

遇到的問題

鏈接失敗

狀態:    正在等待重試...
狀態:    正在鏈接 192.168.0.11:21...
錯誤:    20 秒後無活動,鏈接超時
錯誤:    沒法鏈接到服務器

不用灰心,安裝原本就不是順風順水的,每一個人會根據本身的環境出現不一樣的問題。下面是個人解決方法
首先,要肯定兩邊能 pind 通,虛擬機選擇的是橋接模式,能正常 ping 通。
而後,百度
網上有不少五花八門的解決方法,主要是針對三個方面的
這裏我會貼出幾個網址,由於我按照網站上面的作法沒有鏈接成功,最後是關閉了防火牆才解決的。我對這塊比較薄弱,就不誤人子弟了。貼出來是爲了之後方便之後修改。
第一個操做是關閉匿名,開啓被動模式
第二個操做是開啓防火牆的21端口
第三個操做是修改selinux,開啓外網可訪問nginx

[root@itdragon ~]# vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
pasv_min_port=30000
pasv_max_port=31000
[root@itdragon ~]# service vsftpd restart
[root@itdragon ~]# vim /etc/sysconfig/iptables
-A INPUT -p tcp -m multiport --dport 20,21 -m state --state NEW -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp --dport 30000:31000 -j ACCEPT
[root@itdragon ~]# service iptables restart
[root@itdragon ~]# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
ftp_home_dir --> off
ftpd_connect_db --> off
ftpd_use_fusefs --> off
ftpd_use_passive_mode --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_use_cifs --> off
tftp_use_nfs --> off
[root@itdragon ~]# setsebool -P allow_ftpd_full_access on
[root@itdragon ~]# setsebool -P ftp_home_dir on

參考博客:
http://blog.csdn.net/jiftlixu...
https://jingyan.baidu.com/art...
遺憾的是,我按照上面的方法,沒有鏈接成功,最後一刀切,直接關閉了防火牆。
臨時關閉防火牆不過癮,直接永久關閉防火牆vim

[root@itdragon modprobe.d]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@itdragon modprobe.d]# chkconfig iptables off

上傳失敗

在nginx 安裝目錄下建立了一個images文件夾,經過FileZilla上傳圖片提示錯誤服務器

響應:553 Could not create file.
錯誤:    嚴重文件傳輸錯誤

解決方法以下網絡

[root@itdragon html]# mkdir images
[root@itdragon html]# chmod -R 777 images
[root@itdragon html]# ll
total 12
-rw-r--r--. 1 root root  537 Nov 18 10:53 50x.html
drwxrwxrwx. 2 root root 4096 Nov 18 10:55 images
-rw-r--r--. 1 root root  612 Nov 18 10:53 index.html
[root@itdragon html]# vim /etc/vsftpd/vsftpd.conf 
local_root=/var/ftp
[root@itdragon html]# service vsftpd restart

參考博客:http://blog.chinaunix.net/uid...tcp

注意點

  • 網絡要能ping通網站

  • 防火牆的問題要處理好ui

  • 不能建立文件問題.net

最後,感謝你們閱讀。有什麼建議請賜教!!! Nginx服務器 和 FTP服務器 都準備好了,下一章就是用Nginx+FTP搭建圖片服務器,實現圖片的上傳和批量上傳。

相關文章
相關標籤/搜索