CentOS配置VSFTP 联系客服

发布时间 : 星期三 文章CentOS配置VSFTP更新完毕开始阅读6fd833be5122aaea998fcc22bcd126fff7055d9b

一.安装:

1.安装Vsftpd服务相关部件:

[root@linuxidc.com ~]# yum install vsftpd* -y Dependencies Resolved

=============================================================================

Package Arch Version Repository Size

============================================================================= Installing:

vsftpd i386 2.0.5-10.el5 base 137 kTransaction Summary

============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) 2.确认安装PAM服务相关部件:

[root@linuxidc.com ~]# yum install pam* -y Dependencies Resolved

=============================================================================

Package Arch Version Repository Size

============================================================================= Installing:

pam-devel i386 0.99.6.2-3.14.el5 base 186 kTransaction Summary

============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s)

开发包,其实不装也没有关系,主要的目的是确认PAM。 3.安装DB4部件包:

这里要特别安装一个db4的包,用来支持文件数据库。 [root@linuxidc.com ~]# yum install db4* -y Dependencies Resolved

=============================================================================

Package Arch Version Repository Size

============================================================================= Installing:

db4-devel i386 4.3.29-9.fc6 base 2.0 M db4-java i386 4.3.29-9.fc6 base 1.7 M db4-tcl i386 4.3.29-9.fc6 base 1.0 M

db4-utils i386 4.3.29-9.fc6 base 119 kTransaction Summary

============================================================================= Install 4 Package(s) Update 0 Package(s) Remove 0 Package(s)

二.系统帐户

1.建立Vsftpd服务的宿主用户:

[root@linuxidc.com ~]# useradd vsftpd -s /sbin/nologin

默认的Vsftpd的服务宿主用户是root,但是这不符合安全性的需要。这里建立名字为vsftpd的用户,用他来作为支持Vsftpd的

服务宿主用户。由于该用户仅用来支持Vsftpd服务用,因此没有许可他登陆系统的必要,并设定他为不能登陆系统的用户。 2.建立Vsftpd虚拟宿主用户:

[root@linuxidc.com nowhere]# useradd virtusers -s /sbin/nologin

本篇主要是介绍Vsftp的虚拟用户,虚拟用户并不是系统用户,也就是说这些FTP的用户在系统中是不存在的。他们的总体权限

其实是集中寄托在一个在系统中的某一个用户身上的,所谓Vsftpd的虚拟宿主用户,就是这样一个支持着所有虚拟用户的宿主

用户。由于他支撑了FTP的所有虚拟的用户,那么他本身的权限将会影响着这些虚拟的用户,因此,处于安全性的考虑,也要

非分注意对该用户的权限的控制,该用户也绝对没有登陆系统的必要,这里也设定他为不能登陆系统的用户。

三.调整Vsftpd的配置文件: 1.编辑配置文件前先备份

[root@linuxidc.com ~]# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak

编辑主配置文件Vsftpd.conf

[root@linuxidc.com ~]# vi /etc/vsftpd/vsftpd.conf

这里我将原配置文件的修改完全记录,凡是修改的地方我都会保留注释原来的配置。其中加入我对每条配置项的认识,对于一些比较关键的配置项这里我做了我的观点,并且原本英语的说明我也不删除,供参考对比用。

------------------------------------------------------------------------------ # Example config file /etc/vsftpd/vsftpd.conf #

# The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults. #

# READ THIS: This example file is NOT an exhaustive list of vsftpd options.

# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities. #

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).

#anonymous_enable=YES anonymous_enable=NO

#设定不允许匿名访问,实际环境可以开放匿名用户的登录。 #

# Uncomment this to allow local users to log in. local_enable=YES

#设定本地用户可以访问。注意:主要是为虚拟宿主用户,如果该项目设定为NO那么所有虚拟用户将无法访问。 #

# Uncomment this to enable any form of FTP write command. write_enable=YES #设定可以进行写操作。 #

# Default umask for local users is 077. You may wish to change this to 0