本机环境CentOS-6.6-i386-bin-DVD1.iso安装盘、安装时选择minimal模式。本机IP地址配置为192.168.0.211。

1、查询系统是否已安装了vsftpd

[root@localhost ~]# rpm -qa | grep vsftpd
[root@localhost ~]#

 

通过yum命令安装vsftpd软件

[root@localhost ~]# yum install -y vsftpd
已加载插件:fastestmirror
设置安装进程
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.yun-idc.com
* updates: mirrors.neusoft.edu.cn
解决依赖关系
--> 执行事务检查
---> Package vsftpd.i686 0:2.2.2-13.el6_6.1 will be 安装
--> 完成依赖关系计算 依赖关系解决 ================================================================================
软件包 架构 版本 仓库 大小
================================================================================
正在安装:
vsftpd i686 2.2.2-13.el6_6.1 updates 157 k 事务概要
================================================================================
Install 1 Package(s) 总下载量:157 k
Installed size: 344 k
下载软件包:
vsftpd-2.2.2-13.el6_6.1.i686.rpm | 157 kB 00:11
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-6.el6.centos.12.2.i686 (@anaconda-CentOS-201410241409.i386/6.6)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装 : vsftpd-2.2.2-13.el6_6.1.i686 1/1
Verifying : vsftpd-2.2.2-13.el6_6.1.i686 1/1 已安装:
vsftpd.i686 0:2.2.2-13.el6_6.1 完毕!

 

查看是否安装成功

[root@localhost ~]# rpm -qa | grep vsftp
vsftpd-2.2.2-13.el6_6.1.i686
[root@localhost ~]#

 

证明安装成功,启动服务。

[root@localhost ~]# service vsftpd restart
关闭 vsftpd: [失败]
为 vsftpd 启动 vsftpd: [确定]

 

2、vsftpd配置

vsftpd默认配置是已经打开匿名服务访问的。操作如下:

D:\>ftp
ftp> open 192.168.0.211 (linux主机的IP地址)
连接到 192.168.0.211。
220 (vsFTPd 2.0.5)
用户(192.168.0.211:(none)): anonymous
331 Please specify the password.
密码:
230 Login successful.
ftp>

 

如何禁用匿名登录

[root@localhost/]# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak
修改配置前先备份原配置文件 将anonymous_enable=YES 设置为NO
[root@localhost/]# vi /etc/vsftpd/vsftpd.conf
12 annonymous_enable=NO
[root@localhost/]# service vsftpd restart 重启服务

 

测试

D:\>ftp
ftp> open 192.168.0.211
连接到 192.168.0.211。
220 (vsFTPd 2.0.5)
用户(192.168.0.211:(none)): anonymous
331 Please specify the password.
密码:
530 Login incorrect.
登录失败。
ftp>

登录失败,证明禁用匿名登录配置成功。

 

创建一个系统用户来登录FTP

[root@localhost/]# useradd -s /sbin/nologin fftp
默认新增加的用户还不能登录,需要修改一下密码。
[root@localhost/]# passwd fftp 修改密码
D:\>ftp
ftp> open 192.168.0.211
连接到 192.168.0.211。
220 (vsFTPd 2.0.5)
用户(192.168.0.211:(none)): fftp
331 Please specify the password.
密码:
230 Login successful.

登录成功,新建的系统用户直接就可以登录ftp。默认这些系统用户是没有设置锁定在自己家目录的。测试如下。

ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 3 513 513 4096 Apr 13 14:29 Desktop
226 Directory send OK.
ftp: 收到 65 字节,用时 0.00秒 65000.00千字节/秒。
ftp> cd ..
250 Directory successfully changed.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwx------ 5 513 513 4096 Apr 13 14:29 fftp
drwx------ 2 511 90 4096 Apr 12 14:04 hacluster
drwx------ 6 512 512 4096 Apr 13 13:49 llk
226 Directory send OK.
ftp: 收到 190 字节,用时 0.00秒 190.00千字节/秒。
ftp>

 

可以看到系统用户默认是没有锁定在自己家目录的。那这样不安全。需要配置锁定目录。

[root@localhost/]# vi /etc/vsftpd/vsftpd.conf

去掉前面#号
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list 限制更多系统用户 然后把所有用户加入/etc/vsftpd/chroot_list 即可 [root@localhost/]# ls /etc/vsftpd/chroot_list 默认chroot_list文件是不存在的,需要我们手动建立
ftpusers user_list vsftpd.conf vsftpd.conf.bak vsftpd_conf_migrate.sh [root@localhost/]# touch /etc/vsftpd/chroot_list
[root@localhost/]# cut -d : -f 1 /etc/passwd>>/etc/vsftpd/chroot_list 把本地用户全加入到这个限制文件中
[root@localhost/]# service vsftpd restart 重启服务

 

测试

D:\>ftp
ftp> open 192.168.0.211
连接到 192.168.0.211。
220 (vsFTPd 2.0.5)
用户(192.168.0.211:(none)): fftp
331 Please specify the password.
密码:
230 Login successful.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 3 513 513 4096 Apr 13 14:29 Desktop
226 Directory send OK.
ftp: 收到 65 字节,用时 0.00秒 65000.00千字节/秒。
ftp> cd ..
250 Directory successfully changed.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 3 513 513 4096 Apr 13 14:29 Desktop
226 Directory send OK.
ftp: 收到 65 字节,用时 0.00秒 65.00千字节/秒。
ftp>

经测试发现用户已经被锁定在自己家目录里了。

 

系统添加一个用户默认有ftp的登录权限,是不安全的。要一个个设置,有点繁琐。利用ftp用户策略解决这个问题。即user_list文件设置,只有user_list中存在的用户才能登录系统。

[root@localhost/]# vi /etc/vsftpd/vsftpd.conf
在userlist_enable=YES文件后面添加
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list [root@localhost/]# service vsftpd restart 重启服务

测试

D:\>ftp
ftp> open 192.168.0.211
连接到 192.168.0.211。
220 (vsFTPd 2.0.5)
用户(192.168.0.211:(none)): fftp
530 Permission denied.
登录失败。
ftp>

操作证明配置正确。因为用户fftp没有加入至user_list文件中。所以登录失败。

 

[root@localhost/]# vi /etc/vsftpd/user_list 将用户加至文件最后一行

[root@localhost/]# service vsftpd restart 重启服务

测试

D:\>ftp
ftp> open 192.168.0.211
连接到 192.168.0.211。
220 (vsFTPd 2.0.5)
用户(192.168.0.211:(none)): fftp
331 Please specify the password.
密码:
230 Login successful.
ftp>

登录成功。

有时也想限制一用户不能登录ftp

[root@localhost/]# cat /etc/vsftpd/ftpusers  查看限制用户
可以将限制用户加入。用fftp用户测试。
[root@localhost/]# vi /etc/vsftpd/ftpusers 将fftp用户加入文件最后一行 [root@localhost/]# service vsftpd restart 重启服务

测试

D:\>ftp
ftp> open 192.168.0.211
连接到 192.168.0.211。
220 (vsFTPd 2.0.5)
用户(192.168.0.211:(none)): fftp
331 Please specify the password.
密码:
530 Login incorrect.
登录失败。
ftp>

 

登录失败。证明限制用户已起作用。

Linux vsftp的更多相关文章

  1. Linux VSFTP服务器详细配置

    Linux VSFTP服务器 1.开启服务 [root@localhost root]# service vsftpd start Starting vsftpd for vsftpd:        ...

  2. Linux VSFTP服务器

    Linux VSFTP服务器 一.Linux FTP服务器分类: <1>wu-ftp <2>proftp=profession ftp <3>vsftp=very ...

  3. linux vsftp查看ftp账号信息的方法

    linux vsftp查看ftp账号信息的方法 查看注册的FTP账号 在/etc/vsftpd/chroot_list 密码看不到 只能重置密码 passwd username

  4. LINUX VSFTP配置及安装

    ------------------转载:亲身实践,确实好用(http://www.cnblogs.com/jack-Star/p/4089547.html) 1.VSFTP简介 VSFTP是一个基于 ...

  5. linux vsftp配置

    1.rpm -q ftp 查看是否安装ftp服务器 2.yum install vsftp 安装ftp服务器 3.修改配置文件/etc/vsftpd 下面的 ftpusers和user_list,这两 ...

  6. Linux vsftp配置本地用户

    主要讲的是配置本地用户, ftp现在用的也少了,一般都用ssh和svn 1. 安装ftp  yum -y install vsftpd 2. 配置 /etc/vsftpd/vsftpd.conf # ...

  7. linux vsftp 简单配置

    查看自己是否安装vsftp rpm -qa | grep vsftp rpm -qa 查看自己已安装的包 过滤vsftp systemctl rsetart vsftpd 重启服务 先关闭防火墙 sy ...

  8. 服务器&linux

    linux vsftp查看端口占用:netstat -natp |grep 21如果有占用21端口进程,kill它 ,或者remove它.安装:yum -y install vsftpduseradd ...

  9. linux学习笔记汇总

    linux 文件系统是采用级层树状的目录结构,采用"/"根目录的方式 目录结构: / 根目录           |---root: 存放root用户相关的文件          ...

随机推荐

  1. Android JNI之JAVA与C++对象建立对称关联(JNI优化设计,确保JNI调用的稳定性)

    转载请声明:原文转自:http://www.cnblogs.com/xiezie/p/5930503.html Android JNI之JAVA与C++对象建立对称关联 1.JAVA对象持有C++对象 ...

  2. 利用red5搭建一个简单的流媒体直播系统

    http://blog.sina.com.cn/s/blog_51396f890102exmz.html 一.red5安装.设置. 这个过程就不多说了,参见http://blog.csdn.net/l ...

  3. Test Spring el with ExpressionParser

    Spring expression language (SpEL) supports many functionality, and you can test those expression fea ...

  4. Spring bean configuration inheritance

    In Spring, the inheritance is supported in bean configuration for a bean to share common values, pro ...

  5. 13个Cat命令管理文件实例汇总

    在Linux系统中,大多数配置文件.日志文件,甚至shell脚本都使用文本文件格式,因此,Linux系统存在着多种文本编辑器,但当你仅仅想要查看一下这些文件的内容时,可使用一个简单的命令-cat. c ...

  6. CSS基础(03)

    1.简单了解浏览器是如何渲染页面和加载页面            浏览器就是通过HTTP 协议与服务器进行通信,取到数据之后进行渲染的过程,如图:    这图是园友的看着挺符合我思路就直接拿来用了,从 ...

  7. 命令行创建maven模块工程

    上一边文章,借助外部eclipse来创建模块项目,本文直接使用maven命令来创建 mvn archetype:generate -DgroupId=com.mycompany.demo -Darti ...

  8. SCOM2007R2安装和报表服务器配置

    SCOM2007R2默认安装不可以直接支持SQL Server2008R2,需要SQL Server 2008SP1. 如果数据库安装在另一台计算机上,则在安装了SQL Server的计算机上先运行S ...

  9. python的一些总结2

    第一篇 写了下 基本的环境搭建和一个hello world 程序 下面 介绍接下 怎么使用 python 搭建一个网站.(中间的语法教学 请参考->http://www.liaoxuefeng. ...

  10. Codeforces Round #331 (Div. 2) E. Wilbur and Strings dfs乱搞

    E. Wilbur and Strings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/596 ...