Centos6配置开启FTP Server

vsftpd做为FTP服务器,在Linux系统中是很是经常使用的。下面咱们介绍如何在centos系统上安装vsftp。linux

什么是vsftpdcentos

vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序。特色是小巧轻快,安全易用。安全

vsftpd 的名字表明”very secure FTP daemon”, 安全是它的开发者 Chris Evans 考虑的首要问题之一。在这个 FTP 服务器设计开发的最开始的时候,高安全性就是一个目标。服务器

 

当前系统版本:tcp

[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:ide

[root@AAA ~]# yum install vsftpd

(2)设置开机启动vsftpd ftp服务:测试

[root@AAA ~]# chkconfig vsftpd on

(3)启动vsftpd服务:ui

[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:spa

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并无出现以下错误):.net

假如出现错误
1500 OOPS: cannot change directory
解决方法:
在终端输入命令:
setsebool -P ftpd_disable_trans 1
service vsftpd restart
就OK了!
缘由:这是由于服务器开启了selinux,这限制了FTP的登陆。
相关文章
相关标签/搜索