CENTOS6.5VSFTPD-2.2.2-11 installation (virtual user)

Source: Internet
Author: User

CENTOS6.5VSFTPD-2.2.2-11 installation (virtual user)

-----------------------------------------------------------------

#所用vsftpd服务为CentOS6.5 Self-mirroring


#查看是否有挂载镜像光盘

Df-th

Filesystem Type Size used Avail use% mounted on

/dev/mapper/volgroup-lv_root ext4 18G 3.4G 14G 21%

/tmpfs tmpfs 491M 72K 491M 1%/DEV/SHM

/DEV/SDA1 ext4 485M 35M 426M 8%/boot



#建立/mnt/cdrom CD-ROM mount directory and mount the CD-ROM to this directory, prompting only read-only mount

Mkdir/mnt/cdrom && Mount/dev/cdrom/mnt/cdrom

Mount:block Device/dev/sr0 is write-protected, mounting read-only


------------------------------------------------------------

#建立yum配置文件备份文件夹用于备份原系统yum配置文件

Mkdir/etc/yum.back



#移动yum. REPOS.D configuration file directory from the original configuration file to the Yum profile backup directory that was just created

cd/etc/yum.repos.d/&& MV */etc/yum.back/


#新建光驱yum安装服务的yum配置文件自定义命名为cdyuminstall. Repo

Touch/etc/yum.repos.d/cdyuminstall.repo



#配置文件中写入以下配置信息

Vim/etc/yum.repos.d/cdyuminstall.repo

[Cdinstall]

#自定义命名

Name=cdinstall

#自定义命名

Baseurl=file:///mnt/cdrom

#自定义路径, this path is the disc mount directory

Enabled=1

#是否启用yum源, 0 is not enabled, 1 is enabled

Gpgcheck=0

#是否检查GPG-key,0 for no check, 1 for inspection

#配置完毕wq保存退出

Yum Clean All

#配置完成后要清除下yum缓存

------------------------------------------------------------

#安装光盘内自带的vsftpd服务

Yum Install vsftpd

#等待安装完成查看下已安装的服务信息

Rpm-q vsftpd

Vsftpd-2.2.2-11.el6_4.1.x86_64

#将vsftpd配置文件备份以防配置错误不可挽回, custom backup name Vsftpd.conf.bak

Cp/etc/vsftpd/vsftpd.conf/etc/vsftpd/vsftpd.conf.bak

#将备份后配置文件vsftpd. Conf.bak remove Blank lines and # Beginning of information into the configuration file vsftpd.conf

Cd/etc/vsftpd

Grep-vi "#" Vsftpd.conf.bak | Grep-vi ^$ > vsftpd.conf

#查看下导出的配置文件信息

[email protected] vsftpd]# cat vsftpd.conf

Anonymous_enable=yes

Local_enable=yes

Write_enable=yes

local_umask=022

Dirmessage_enable=yes

Xferlog_enable=yes

Connect_from_port_20=yes

Xferlog_std_format=yes

Listen=yes

Pam_service_name=vsftpd

Userlist_enable=yes

Tcp_wrappers=yes

[email protected] vsftpd]#

#确定系统集成db4版本

Rpm-q DB4

Db4-4.7.25-18.el6_4.x86_64

#建立自定义命名临时文本文件并写入虚拟用户用户名密码

Vim Vusers.txt

[email protected] vsftpd]# cat Vusers.txt

Test

#虚拟用户账户

Test

#虚拟用户密码

[email protected] vsftpd]#

#将刚刚建立的文本载入到自定义命名的数据库虚拟用户

Db_load-t-T hash-f vusers.txt vsftpd-virtual-user.db

#建立pam认证配置文件并指定数据库文件路径

Vim/etc/pam.d/vsftpd.virtual

[email protected] vsftpd]# cat/etc/pam.d/vsftpd.virtual

Auth required/lib64/security/pam_userdb.so Db=/etc/vsftpd/vsftpd-virtual-user

Account Required/lib64/security/pam_userdb.so Db=/etc/vsftpd/vsftpd-virtual-user

[email protected] vsftpd]#

#创建虚拟用户配置目录用于存放虚拟用户配置信息

Mkdir-pv/etc/vsftpd/vhome

#建立虚拟用户宿主目录 for virtual user logon access to data

Mkdir/usr/html

#对新建原来建立已经导入数据库的虚拟用户test进行权限分配

Vim/etc/vsftpd/vhome/test

[email protected] vsftpd]# cat/etc/vsftpd/vhome/test

Anon_world_readable_only=no

Anon_upload_enable=yes

Anon_mkdir_write_enable=yes

Anon_other_write_enable=yes

anon_umask=033

local_root=/usr/html/


[email protected] vsftpd]#

#建立系统用户web并且给他分配目录权限

Useradd-s/sbin/nologin-c "Web" web

Chown-r web.web/usr/html

#目录必须不可写

chmod a-w/usr/html

Adding virtual User Configuration Information #在vsftpd. conf configuration file

[email protected] vsftpd]# cat vsftpd.conf

Anonymous_enable=yes

Local_enable=yes

Write_enable=yes

local_umask=022

Dirmessage_enable=yes

Xferlog_enable=yes

Connect_from_port_20=yes

Xferlog_std_format=yes

Listen=yes

Pam_service_name=vsftpd.virtual

Userlist_enable=yes

Tcp_wrappers=yes

#以上为原配置文件内容, only the PAM authentication file name has been modified, do not use the default Pam authentication profile, the following is the new configuration information

Guest_enable=yes

Guest_username=web

User_config_dir=/etc/vsftpd/vhome


[email protected] vsftpd]#


#修改配置文件信息后重启下相应的服务

[email protected] vsftpd]# service vsftpd restart

Close vsftpd: [OK]

Start vsftpd for vsftpd: [OK]

[email protected] vsftpd]#

Setenforce 0

#暂时关闭selinux模式, you will get an error when you log in to your virtual account, or you can permanently shut down write Vi/etc/sysconfig/selinux profile selinux=disabled need to restart the server , the SELinux mode status can be viewed with Getenforce after a write configuration file restart

--------------------------------------------------------

#在vsftp访问目录下新建目录和文件用于测试

mkdir/usr/html/test111 && touch/usr/html/222

#安装lftp服务用于访问测试

Yum Install Lftp

#尝试用虚拟用户登录测试

[email protected] vsftpd]# lftp 127.0.0.1

Lftp 127.0.0.1:~> User Test

Password: Test

LFTP [email protected]:~> ls

-rw-r--r--1 0 Dec 01 06:56 222

Drwxr-xr-x 2 0 0 4096 Dec 07:51 test111

LFTP [email protected]:/>


-------------------------finished-------------------------



This article from "Rookie Break the World" blog, please be sure to keep this source http://810072525.blog.51cto.com/4465433/1727199

CENTOS6.5VSFTPD-2.2.2-11 installation (virtual user)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.