本机环境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. dfs.datanode.max.xcievers参数导致hbase集群报错

    2013/08/09 转发自http://bkeep.blog.163.com/blog/static/123414290201272644422987/ [案例]dfs.datanode.max.x ...

  2. Linux下tar.xz结尾的文件的解压方法

    $xz -d ***.tar.xz $tar -xvf  ***.tar 可以看到这个压缩包也是两层压缩,外面是xz压缩方式,里层是tar压缩方式.

  3. [ASP.NET MVC] Child actions are not allowed to perform redirect

    我在Umbraco平台下,用MVC(SurfaceController)开发时,遇到这个问题 MemberEdit是一个partial View [HttpGet] [ActionName(" ...

  4. Mac下的eclipse 4.6的tomcat插件安装正确姿势

    最新版 eclipse 4.6 (Neon) tomcat 插件的安装, 解决tomcat插件tomcatPluginV331不能使用的问题. 1.打开最新版的 eclipse 4.6 (neon), ...

  5. Egret项目Typescript的编译报错

    今天编译项目,出现了一个奇怪的报错,如下: E:\engine\egret-core-3.1.2\tools\lib\typescript\tsclark.js:41531 1> if (fil ...

  6. Tiny6410声卡驱动——录音与回放

    在Linux下,音频设备程序的实现与文件系统的操作密切相关.Linux将各种设备以文件的形式给出统一的接口,这样的设计使得对设备的编程与对文件的操作基本相同,对Linux内核的系统调用也基本一致,从而 ...

  7. linx目录结构

    linux中的命令一般存放在/bin目录下的: 以下为linux下的基本目录结构和作用: /根目录./boot引导程序,内核等存放的目录./sbin超级用户可以使用的命令的存放目录./bin普通用户可 ...

  8. WinFrom界面框架之WeifenLuo.WinFormsUI.Docking + OutLookBar

    本文转载:http://www.cnblogs.com/luomingui/p/3329763.html WeifenLuo.WinFormsUI.Docking + OutLookBar结合使用的效 ...

  9. PostgreSQL的 initdb 源代码分析之十一

    继续分析: /* Top level PG_VERSION is checked by bootstrapper, so make it first */ write_version_file(NUL ...

  10. PostgreSQL的initdb 源代码分析之六

    继续分析 下面的是获取运行此程序的用户名称,主要还是为了防止在linux下用root来运行的情形. effective_user = get_id(); ) username = effective_ ...