1.安装
[root@VM114 download]# yum install vsftpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* remi: remi.kazukioishi.net
* updates: mirrors.yun-idc.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-13.el6_6.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
vsftpd x86_64 2.2.2-13.el6_6.1 updates 151 k
Transaction Summary
=============================================================================================================================
Install 1 Package(s)
Total download size: 151 k
Installed size: 332 k
Is this ok [y/N]: y
Downloading Packages:
vsftpd-2.2.2-13.el6_6.1.x86_64.rpm | 151 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-13.el6_6.1.x86_64 1/1
Verifying : vsftpd-2.2.2-13.el6_6.1.x86_64 1/1
Installed:
vsftpd.x86_64 0:2.2.2-13.el6_6.1
Complete!
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* remi: remi.kazukioishi.net
* updates: mirrors.yun-idc.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-13.el6_6.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
vsftpd x86_64 2.2.2-13.el6_6.1 updates 151 k
Transaction Summary
=============================================================================================================================
Install 1 Package(s)
Total download size: 151 k
Installed size: 332 k
Is this ok [y/N]: y
Downloading Packages:
vsftpd-2.2.2-13.el6_6.1.x86_64.rpm | 151 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-13.el6_6.1.x86_64 1/1
Verifying : vsftpd-2.2.2-13.el6_6.1.x86_64 1/1
Installed:
vsftpd.x86_64 0:2.2.2-13.el6_6.1
Complete!
2.配置Vsftpd
安装完之后我们要对它进行配置,才能正常使用。编辑vsftpd的配置文件vi /etc/vsftpd/vsftpd.conf
vi编辑器中的搜索使命是斜杠“/”,然后输入要查找的内容,回车确定。以下是要更改的选项
anonymous_enable=NO #禁止匿名访问
ascii_upload_enable #允许使用ascii码上传
ascii_download_enable #允许使用ascii码下载
userlist_deny=NO #(这条需手动添加到最后)使用FTP用户表,表里没有的用户需要添加才能登录
设置完毕之后,ESC,冒号wq回车。启动vsftpd服务/etc/init.d/vsftpd start或者执行service vsftpd start,看到[确定]即为启动成功。
安装完之后我们要对它进行配置,才能正常使用。编辑vsftpd的配置文件vi /etc/vsftpd/vsftpd.conf
vi编辑器中的搜索使命是斜杠“/”,然后输入要查找的内容,回车确定。以下是要更改的选项
anonymous_enable=NO #禁止匿名访问
ascii_upload_enable #允许使用ascii码上传
ascii_download_enable #允许使用ascii码下载
userlist_deny=NO #(这条需手动添加到最后)使用FTP用户表,表里没有的用户需要添加才能登录
设置完毕之后,ESC,冒号wq回车。启动vsftpd服务/etc/init.d/vsftpd start或者执行service vsftpd start,看到[确定]即为启动成功。
如果启动报错:
Starting vsftpd for vsftpd: 500 OOPS: bad bool value in config file for: ascii_upload_enable
[FAILED]
[FAILED]
原因:
ascii_upload_enable=YES #允许使用ascii码上传
ascii_download_enable=YES #允许使用ascii码下载
ascii_download_enable=YES #允许使用ascii码下载
这两行后面不要添加注释
解决方案:
去除行末尾的注释
启动成功:
Starting vsftpd for vsftpd: [ OK ]
只启动完还不行,还要给它添加开机自动启动,chkconfig vsftpd on
只启动完还不行,还要给它添加开机自动启动,chkconfig vsftpd on
添加启动是没有任何提示的,如果不确定是否已经加入了开机启动项可以运行chkconfig –list进行查看。
3.添加用户
安装和配置完之后要对它添加用户才能使用,这里以添加用户baidu为例。
useradd baidu回车,然后为baidu这个用户添加密码passwd baidu,会提示输入两次密码。
然后我们将baidu这个用户加入到FTP用户表里。
vi /etc/vsftpd/user_list,将里面其它初始用户全部删除,加入刚刚我们新建的baidu用户。
useradd baidu回车,然后为baidu这个用户添加密码passwd baidu,会提示输入两次密码。
然后我们将baidu这个用户加入到FTP用户表里。
vi /etc/vsftpd/user_list,将里面其它初始用户全部删除,加入刚刚我们新建的baidu用户。
4.关闭selinux
vim /etc/selinux/config
SELINUX=disabled
然后reboot重启Linux服务器。
5.关闭防火墙
service iptables stop
chkconfig iptables off
vim /etc/selinux/config
SELINUX=disabled
然后reboot重启Linux服务器。
5.关闭防火墙
service iptables stop
chkconfig iptables off
如果不想重启服务器就关闭selinux可以执行命令:setenforce 0
6.连接ftp
本人使用FlashFXP客户端软件连接,直到出现用户主目录(一般位于/home/用户名),则vsftpd成功安装并运行。
然后就能进行文件的上传和下载了。
6.连接ftp
本人使用FlashFXP客户端软件连接,直到出现用户主目录(一般位于/home/用户名),则vsftpd成功安装并运行。
然后就能进行文件的上传和下载了。
更进一步的安全配置策略暂时还没研究,希望多提意见。
相关参考资料