Centos6配置開啟FTP Server


vsftpd作為FTP服務器,在Linux系統中是非常常用的。下面我們介紹如何在centos系統上安裝vsftp。

什么是vsftpd

vsftpd是一款在Linux發行版中最受推崇的FTP服務器程序。特點是小巧輕快,安全易用。

vsftpd 的名字代表”very secure FTP daemon”, 安全是它的開發者 Chris Evans 考慮的首要問題之一。在這個 FTP 服務器設計開發的最開始的時候,高安全性就是一個目標。

 

當前系統版本:

[root@AAA ~]# cat /proc/version 
Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014
[root@AAA ~]# cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m

 

(1)安裝vsftpd:

[root@AAA ~]# yum install vsftpd

(2)設置開機啟動vsftpd ftp服務:

[root@AAA ~]# chkconfig vsftpd on

(3)啟動vsftpd服務:

[root@AAA ~]# chkconfig vsftpd on
[root@AAA ~]# service vsftpd on
Usage: /etc/init.d/vsftpd {start|stop|restart|try-restart|force-reload|status}
[root@AAA ~]# service vsftpd start
Starting vsftpd for vsftpd:                                [  OK  ]

(4)配置vsftpd服務器

vi /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
#anonymous_enable=YES

chroot_local_user=YES
#去掉前面的注釋

#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list
#不受限制的用戶列表,用不用都OK

(5)配置防火牆並重啟防火牆:

[root@AAA ~]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
[root@AAA ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

 

本機測試ftp root:

C:\Users\uname>ftp 10.60.9.4
Connected to 10.60.9.4.
220 (vsFTPd 2.2.2)
User (10.60.9.4:(none)): root
331 Please specify the password.
Password:
230 Login successful.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x    4 0        0            4096 Mar 08  2016 Desktop
drwxr-xr-x    2 0        0            4096 Dec 25  2015 Documents
drwxr-xr-x    2 0        0            4096 Dec 25  2015 Downloads
...

 

附錄(Centos6.6上設置vsftpd並沒有出現如下錯誤):

假如出現錯誤
1500 OOPS: cannot change directory
解決方法:
在終端輸入命令:
setsebool -P ftpd_disable_trans 1
service vsftpd restart
就OK了!
原因:這是因為服務器開啟了selinux,這限制了FTP的登錄。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM