CentOS 6.4 i386的学习笔记-003 vsftp 的安装与简单配置

本文介绍在CentOS 6.4环境下通过yum安装vsftpd,并进行配置的过程,包括设置开机启动、新建虚拟账户、配置vsftpd.conf等步骤。

笔记已经上传到百度文库:
CentOS 6.4 i386的学习笔记-003 vsftp 的安装与简单配置.pdf


本篇笔记内容介绍

CentOS 6.4下,通过yum的方式安装vsftpd,并进行简单配置。


第一步:安装软件

[vm20vm20]$ su – root

Password: //输入密码后,回车。提示:输入的密码不显示。

[vm20vm20]# yum install vsftpd pam* db4* -y

回车后,一直等到出现下面的Complete!提示,就表示安装成功了。

Complete

[vm20vm20]#


第二步:设置开机启动vsftpd

[vm20vm20]# chkconfig --level 35 vsftpd on


第三步:新建ftp虚拟帐户

[vm20vm20]# useradd ftpuser -s /sbin/nologin

提示:新建的ftpuser虚拟帐户不是用来登录ftp的。


第四步:配置vsftpd.conf

更改配置前,做好原始配置文件的备份,然后再改。


1、新建原始配置文件的备份目录。

[vm20vm20]# mkdir /folder/bak

这样就在/folder文件夹下新建了一个保存全部备份文件的/bak文件夹。


2、备份vsftpd.conf

[vm20vm20]# cp /etc/vsftpd/vsftpd.conf /folder/bak/vsftpd.conf.bak.20130605-etc-vsftpd

简单解释一下cp命令(cp = copy)。

cp命令的使用格式:cp需要备份的文件备份后的文件

因此,这条命令就是把/etc/vsftpd/vsftpd.conf这个文件复制到

/folder/bak这个文件夹下面,同时重新命名这个复制后的文件为

vsftpd.conf.bak.20130605-etc-vsftpd

这个长长的文件名的意思是:

vsftpd.conf .bak .20130605 -etc-vsftpd

原始文件名表示备份备份时间原始文件所在目录(便于恢复)



3、配置vsftpd.conf

修改配置文件之前,先了解一下vi编辑器的简单使用:

i键,进入插入模式,可以修改文件内容,用键盘的上下左右键移动光标;

Esc键,回到命令模式,不可以修改文件内容,支持一定的命令。

在命令模式下,输入:wq就可以保存修改过的文件并退出。

还可以连续两次按快捷键ShiftZ,同样也是保存并退出vi编辑器

Vi编辑器的简单使用就介绍到这里。


提示:在vsftpd.conf这个配置文件中,#表示注释。在vsftpd.conf文件中,被# 注释的行,有的是说明,有的是不需要执行的配置。

现在,开始修改vsftpd.conf这个配置文件。

把配置文件中的相关部分,修改成下面的设置。


[vm20vm20]# vi /etc/vsftpd/vsftpd.conf

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

#

#The default compiled in settings are fairly paranoid. This samplefile

#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 vsftpdoptions.

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

#capabilities.

#

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

anonymous_enable=YES

#

#Uncomment this to allow local users to log in.

local_enable=YES

#

#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 to022,

#if your users expect that (022 is used by most other ftpd's)

local_umask=022

#

#Uncomment this to allow the anonymous FTP user to upload files. Thisonly

#has an effect if the above global write enable is activated. Also,you will

#obviously need to create a directory writable by the FTP user.

#anon_upload_enable=YES

#

#Uncomment this if you want the anonymous FTP user to be able tocreate

#new directories.

#anon_mkdir_write_enable=YES

#

#Activate directory messages - messages given to remote users whenthey

#go into a certain directory.

dirmessage_enable=YES

#

#The target log file can be vsftpd_log_file or xferlog_file.

#This depends on setting xferlog_std_format parameter

xferlog_enable=YES

#

#Make sure PORT transfer connections originate from port 20(ftp-data).

connect_from_port_20=YES

#

#If you want, you can arrange for uploaded anonymous files to be ownedby

#a different user. Note! Using "root" for uploaded files isnot

#recommended!

#chown_uploads=YES

#chown_username=whoever

#

#The name of log file when xferlog_enable=YES andxferlog_std_format=YES

#WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log

#xferlog_file=/var/log/xferlog

#

#Switches between logging into vsftpd_log_file and xferlog_file files.

#NO writes to vsftpd_log_file, YES to xferlog_file

xferlog_std_format=YES

#

#You may change the default value for timing out an idle session.

idle_session_timeout=600

#

#You may change the default value for timing out a data connection.

#data_connection_timeout=120

#

#It is recommended that you define on your system a unique user whichthe

#ftp server can use as a totally isolated and unprivileged user.

#nopriv_user=ftpsecure

#

#Enable this and the server will recognise asynchronous ABOR requests.Not

#recommended for security (the code is non-trivial). Not enabling it,

#however, may confuse older FTP clients.

async_abor_enable=YES

#

#By default the server will pretend to allow ASCII mode but in factignore

#the request. Turn on the below options to have the server actually doASCII

#mangling on files when in ASCII mode.

#Beware that on some FTP servers, ASCII support allows a denial ofservice

#attack (DoS) via the command "SIZE /big/file" in ASCIImode. vsftpd

#predicted this attack and has always been safe, reporting the size ofthe

#raw file.

#ASCII mangling is a horrible feature of the protocol.

ascii_upload_enable=YES

ascii_download_enable=YES

#

#You may fully customise the login banner string:

ftpd_banner=Welcometo blah FTP service.

#

#You may specify a file of disallowed anonymous e-mail addresses.Apparently

#useful for combatting certain DoS attacks.

#deny_email_enable=YES

#(default follows)

#banned_email_file=/etc/vsftpd/banned_emails

#

#You may specify an explicit list of local users to chroot() to theirhome

#directory. If chroot_local_user is YES, then this list becomes a listof

#users to NOT chroot().

chroot_local_user=YES

chroot_list_enable=YES

#(default follows)

chroot_list_file=/etc/vsftpd/chroot_list

#

#You may activate the "-R" option to the builtin ls. This isdisabled by

#default to avoid remote users being able to cause excessive I/O onlarge

#sites. However, some broken FTP clients such as "ncftp" and"mirror" assume

#the presence of the "-R" option, so there is a strong casefor enabling it.

#ls_recurse_enable=YES

#

#When "listen" directive is enabled, vsftpd runs instandalone mode and

#listens on IPv4 sockets. This directive cannot be used in conjunction

#with the listen_ipv6 directive.

listen=YES

#

#This directive enables listening on IPv6 sockets. To listen on IPv4and IPv6

#sockets, you must run two copies of vsftpd with two configurationfiles.

#Make sure, that one of the listen options is commented !!

#listen_ipv6=YES


pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES


#手动添加下面的内容

guest_enable=YES
guest_username=ftpuser
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/vconf

#配置文件到这里就修改完成了

下面的内容,就是简单解释一下相关的设置:


anonymous_enable=YES//不允许匿名用户访问


local_enable=YES//允许本地用户访问


write_enable=YES //允许用户执行写入操作


local_umask=022//文件上传以后的权限掩码


dirmessage_enable=YES//开启活动目录信息


xferlog_enable=YES//开启记录日志功能


connect_from_port_20=YES //设定连接端口为20


xferlog_std_format=YES //设置日志的格式


idle_session_timeout=600//会话超时的时间设置


async_abor_enable=YES//支持异步传输功能


ascii_upload_enable=YES//支持ASCII模式的下载功能


ascii_download_enable=YES //支持ASCII模式的上传功能


ftpd_banner=Welcometo blah FTP service. //FTP登录的欢迎语


chroot_local_user=YES//禁止本地用户登出自己的FTP主目录


chroot_list_enable=YES //不允许FTP用户离开自己的主目录


chroot_list_file=/etc/vsftpd/chroot_list

//如果开启了chroot_list_enable=YES,那么一定要开启这个设

置,这条设置是锁定登录用户只能家目录的位置,如果不开启这

个设置,那么,用户登录时就有错误提示。
提示:/etc/vsftp/chroot_list这个文件本身是不存在的,配置完

成后,需要在/etc/vsftp这个目录下建立chroot_list这个文件,

然后将需要登录的帐户,以一行一个用户名的格式记录到这个文件

里,保存就OK了。


pam_service_name=vsftpd//设定pam服务下vsftpd的验证配置文件名


userlist_enable=YES//拒绝登录用户名单


tcp_wrappers=YES//限制主机对vsftp服务器的访问


guest_enable=YES //设定启用虚拟用户功能


guest_username=ftpuser //
指定虚拟用户的宿主用户


virtual_use_local_privs=YES  //
设定虚拟用户的权限符合他们的宿主用户


user_config_dir=/etc/vsftpd/vconf  //
设定虚拟用户配置文件存放路径


第五步:创建日志文件

[vm20vm20]# touch /var/log/vsftpd.log//创建日志文件

[vm20vm20]# chown ftpuser.ftpuser /var/log/vsftpd.log

//使新创建的vsftpd.log文件,属于ftpuser这个宿主。



第六步:创建虚拟用户文件

[vm20vm20]# mkdir /etc/vsftpd/vconf//新建存放虚拟用户的目录



第七步:新建虚拟用户

[vm20vm20]# touch /etc/vsftpd/vconf/vir_user//新建文件

[vm20vm20]# vi /etc/vsftpd/vconf/vir_user

virftpuser //这一行是用户名

123456789 //这一行是对应的密码

提示:在vir_user这个文件里,第一行(奇数行)是用户名,第二行(偶数行)是用户名对应的密码。如果有其他用户,以此类推。


第八步:生成数据库

[vm20vm20]# db_load -T -t hash -f /etc/vsftpd/vconf/vir_user /etc/vsftpd/vconf/vir_user.db

在相同的文件夹下,生成同名的数据库vir_user.db文件。


第九步:设置数据库和用户文件的访问权限

[vm20vm20]# chmod 600/etc/vsftpd/vconf/vir_user.db

[vm20vm20]# chmod 600/etc/vsftpd/vconf/vir_user


第十步:修改/etc/pam.d/vsftpd的内容

[vm20vm20]# echo "authrequired pam_userdb.so db=/etc/vsftpd/vconf/vir_user" >/etc/pam.d/vsftpd

[vm20vm20]# echo"account required pam_userdb.so db=/etc/vsftpd/vconf/vir_user">> /etc/pam.d/vsftpd


第十一步:创建登录用户的配置文件

提示:创建的登录用户配置文件的名字要和前面第步里新建的“虚拟用户”的名字相同。

[vm20vm20]# touch /etc/vsftpd/vconf/virftpuser

[vm20vm20]# vi /etc/vsftpd/vconf/virftpuser

文件内容如下:

local_root=/home/virftpuser //虚拟用户的个人目录路径
anonymous_enable=NO
write_enable=YES
local_umask=022
anon_upload_enable=NO
anon_mkdir_write_enable=NO
idle_session_timeout=600
data_connection_timeout=120
max_clients=10
max_per_ip=5
local_max_rate=1048576 //
本地用户的最大传输速度,

单位是Byts/s,这里设定为10M



第十二步:新建chroot_list文件

[vm20vm20]# touch /etc/vsftpd/chroot_list

[vm20vm20]# vi /etc/vsftpd/chroot_list

里面就一行,内容是:

virftpuser

提示:这个文件前面已经说过了,需要注意的就是一行只写一个授权登录的用户名。本例中就一个用户,就写一行,如果有10个用户,就需要写10行了。


第十三步:建立虚拟用户目录
如果不建立虚拟用户的个人目录,那么所有的虚拟用户登录后所在的目录都是同一个目录下
[vm20
vm20]# mkdir /home/virftpuser
[vm20vm20]# chown ftpuser.ftpuser /home/virftpuser
[vm20vm20]# chmod 600 /home/virftpuser



vsftpd.conf的配置到这里就完成了,在以后的使用中,如果想添加新的用户,只要在上面的第七步的文件里添加新的用户、第八步重新生成数据库文件、按照第十一步的方法和内容创建新用户的配置文件,就OK了。



第十四步:修改selinux关于vsftp的设置

1、查看selinux的设置

[vm20vm20]# cat /etc/selinux/config

#This file controls the state of SELinux on the system.

#SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=enforcing

#SELINUXTYPE= can take one of these two values:

# targeted - Targeted processes are protected,

# mls - Multi Level Security protection.

SELINUXTYPE=targeted



2、查看selinux中有关FTP的设置状态

[vm20vm20]# getsebool -a | grep ftp

allow_ftpd_anon_write--> off

allow_ftpd_full_access--> off

allow_ftpd_use_cifs--> off

allow_ftpd_use_nfs--> off

ftp_home_dir--> off

ftpd_connect_db--> off

ftpd_use_passive_mode--> off

httpd_enable_ftp_server--> off

tftp_anon_write--> off



3、修改selinux中关于FTP的设置

[vm20vm20]# setsebool -P ftp_home_dir 1

[vm20vm20]# setsebool -P allow_ftpd_full_access 1



4、再次查看selinux中有关FTP的设置状态

[vm20vm20]# getsebool -a | grep ftp

allow_ftpd_anon_write--> off

allow_ftpd_full_access--> on

allow_ftpd_use_cifs--> off

allow_ftpd_use_nfs--> off

ftp_home_dir--> on

ftpd_connect_db--> off

ftpd_use_passive_mode--> off

httpd_enable_ftp_server--> off

tftp_anon_write--> off



5、重启vsftpd服务

[vm20vm20]# service vsftpd restart



第十五步:关闭iptables服务

[vm20vm20]# service iptables stop


经过设置,现在终于可以访问了,呵呵~~


文中所介绍的vsftp的安装与简单配置,目的就是让vsftp先运行起来,有关vsftp的更多的配置,请百度或Google


抛砖引玉,如有错漏,敬请指正。






笔记已经上传到百度文库:
CentOS 6.4 i386的学习笔记-003 vsftp 的安装与简单配置.pdf




(完) 2013 6 5 14 :12
代码转载自:https://pan.quark.cn/s/8ce4326d996e 对于在 CentOS 7 系统中修改网卡配置文件后无法使设置生效的情况,经过实践验证,可以通过使用 nmcli 命令来进行调整。完成修改之后,需要重新启动虚拟机以使更改生效,这样操作流程即告完成。如果设置仍然无法生效,则表明虚拟机在启动过程中所获取的 IP 地址配置并非针对 eth0,此时可以对其它网卡的配置文件进行修改或将其移除。在 CentOS 7 系统中,网络配置的管理机制早期版本存在差异,主要体现为采用了 Network Manager 服务来负责网络接口的管理。在某些情形下,尽管修改了 `/etc/sysconfig/network-scripts` 目录下的 `ifcfg-eth0` 文件,但网络配置却未能即时生效。此类问题的发生通常源于 CentOS 7 采用了不同于以往的配置读取方法。接下来将具体阐述如何借助 nmcli 命令来处理这一挑战。 以 root 用户身份登录系统并打开终端界面。nmcli 是 Network Manager 提供的命令行界面工具,它支持在命令行环境下执行网络连接的建立、编辑、查询及管理任务。针对修改 eth0 网卡配置的需求,可以遵循以下步骤进行操作: 1. 导航至 `/etc/sysconfig/network-scripts` 目录: ``` cd /etc/sysconfig/network-scripts ``` 2. 检查该目录内是否存在 `ifcfg-eth0.bak` 文件,该备份文件可能是先前调整配置时遗留下来的,若存在可能造成冲突。若发现该文件,可以选择将其删除: ``` [root@localhost netw...
代码转载自:https://pan.quark.cn/s/46fd08fb879c 网管教程 从入门到精通软件篇 ★一。★详尽的xp修复控制台指令及其应用!!! 放入xp(2000)的光盘,安装时选择R,执行修复! Windows XP(涵盖 Windows 2000)的控制台指令是在系统遭遇某些意外状况时的一种极具效用的诊断、检测以及恢复系统功能的工具。笔者确实一直期望能够将这方面的指令进行归纳,此次由老范辛苦整理了这份极具价值的秘籍。 Bootcfg bootcfg 命令用于启动配置故障恢复(对大多数计算机而言,即 boot.ini 文件)。 带有特定参数的 bootcfg 命令仅在运用故障恢复控制台时方可使用。能够在命令行界面下运用带有不同参数的 bootcfg 命令。 用法: bootcfg /default 设定默认引导选项。 bootcfg /add 向引导清单中增添 Windows 安装。 bootcfg /rebuild 重复整个 Windows 安装流程并让用户选择需添加的项目。 注意:运用 bootcfg /rebuild 之前,应先借助 bootcfg /copy 命令备份 boot.ini 文件。 bootcfg /scan 探查用于 Windows 安装的全部磁盘并展示结果。 注意:这些结果被静态存储,并用于当前会话。若在当前会话期间磁盘配置发生变动,为获取更新的探查结果,必须先重启计算机,然后再次探查磁盘。 bootcfg /list 列示引导清单中已有的项目。 bootcfg /disableredirect 在启动引导程序中禁用重定向。 bootcfg /redirect [ PortBaudRrate] |[ useBio...
代码下载链接: https://pan.quark.cn/s/fc524f791b68 AA制程,即Active Alignment,被理解为主动对准,是一种用于确定零部件装配中相对位置的方法。在摄像头封装阶段,涉及图像传感器、镜座、马达、镜头、线路板等多个部件的重复组装,而传统的封装设备如CSP及COB等,均是依据设备设定的参数进行零部件的移动装配,因而零部件的叠加误差会逐渐增大,最终在摄像头上表现为拍照最清晰的位置可能偏离画面中心、四边清晰度不均等现象。伴随智能手机和其他高端电子产品的普及,摄像头模组的性能正日益受到重视。高分辨率、卓越的低光表现以及稳定视频输出是现代用户所期望的。在摄像头模组的制造环节,各部件的精准定位对成像质量具有决定性作用。因此,一种名为“AA制程”(Active Alignment)的前沿技术被开发出来,成为摄像头精密对准的核心技术。 AA制程,即Active Alignment,是一种在摄像头封装过程中应用的主动对准方法。该方法在多个组件装配阶段发挥作用,涵盖图像传感器、镜座、马达、镜头和线路板等部件。传统的封装方式,例如CSP(Chip Scale Package)和COB(Chip On Board),依赖于设备预设的参数进行组装,但随着组件数量的增加,误差也会累积,最终影响摄像头的表现。例如在成像质量上可能出现中心位置偏移、四角清晰度不一致等问题。 AA制程技术的核心在于实时监测主动调整。在组装过程中,它借助先进的检测设备持续监控半成品的状态,并根据实时信息对组装部件进行精确修正,从而显著降低装配误差。通过这种技术,能够确保摄像头模组中各组件的相对位置准确无误,从而使得最终的成像效果更加稳定,特别是在中心区域和四角的清晰度上...
内容概要:本文介绍了一套基于Matlab实现的光子晶体90度弯曲波导的二维时域有限差分法(2D FDTD)仿真代码,旨在通过数值模拟手段深入研究光子晶体波导中的光传播特性。该资源聚焦于电磁场光子学领域的仿真技术应用,系统实现了FDTD算法在复杂介质结构中的建模过程,涵盖空间网格剖分、时间步进迭代、完美匹配层(UPML)边界条件处理、总场散射场(TFSF)激励源设置、介电常数分布定义及电磁场演化可视化等核心模块,能够有效分析光在90度弯曲波导中的传输效率、模式分布反射损耗等关键性能指标。; 适合人群:具备电磁场理论基础和Matlab编程能力的研究生、科研人员以及从事光子晶体器件设计仿真的工程技术人员。; 使用场景及目标:①用于教学演示FDTD方法的基本原理算法流程,帮助理解麦克斯韦方程的离散化求解过程;②支撑科研工作中对光子晶体弯曲波导结构的传输特性进行仿真分析性能优化;③作为开发更复杂光子集成器件(如分束器、滤波器)数值仿真工具的基础框架; 阅读建议:建议使用者结合经典FDTD教材(如Taflove著作)深入理解算法理论,并在Matlab环境中逐模块调试代码,重点关注电场磁场的交替更新过程、UPML吸收边界的设计实现以及TFSF源的引入方式,从而全面提升对时域电磁仿真机制的掌握应用能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值