假设我们有以下要求

路径 权限 备注
/ftp/open 公司所有人员包括来宾均可以访问 只读
/ftp/private 仅允许Alice、Jack、Tom三个人访问

Alice、Jack只允许下载,

Tom可以上传  均使用虚拟账户

安装FTP

1
2
3
4
5
6
7
8
9
//使用yum安装
# yum -yinstall ftp vsftpd
//或者使用rpm安装以下两个包
ftp-0.17-66.el7.x86_64
vsftpd-3.0.2-9.el7.x86_64
//另外需要安装db包,用来加密虚拟用户的账户信息
//这个包在centos7中默认已经安装了
# rpm -qf/usr/bin/db_load
libdb-utils-5.3.21-17.el7_0.1.x86_64

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# mkdir/ftp/open
做几个测试文件
# echo opentest > /ftp/open/open.txt
# echo filetest > /tmp/filetest1.txt
  
# touch /ftp/open/anontest.txt
 //查看配置文件所在路径
# rpm -qc vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
  
# cd /etc/vsftpd/
//备份原有配置文件
# cp vsftpd.conf vsftpd.conf.origin
  
//创建密码明文文件
# vi/etc/vsftpd/vftpuser.txt
alice
P@ssw0rd
jack
P@ssw0rd
tom
P@ssw0rd
  
//根据明文创建密码DB文件
# db_load -T -t hash -f /etc/vsftpd/vftpuser.txt \
/etc/vsftpd/vftpuser.db
  
//查看密码数据文件
# file/etc/vsftpd/vftpuser.db
/etc/vsftpd/vftpuser.db: Berkeley DB (Hash, version9, native byte-order)
  
//创建vftpd的guest账户
# useradd -d/ftp/private -s /sbin/nologin vftpuser
  
# vi/etc/pam.d/vsftpd
将auth及account的所有配置行行均注释掉,添加如下内容:
auth required pam_userdb.so db=/etc/vsftpd/vftpuser
account required pam_userdb.sodb=/etc/vsftpd/vftpuser
//打开配置文件
# vi/etc/vsftpd/vsftpd.conf
//在最后添加
anon_root=/ftp/open
virtual_use_local_privs=YES
guest_enable=YES
guest_username=vftpuser
chroot_local_user=YES
allow_writeable_chroot=YES
 //设置自动启动
# systemctl enable vsftpd
ln -s'/usr/lib/systemd/system/vsftpd.service''/etc/systemd/system/multi-user.target.wants/vsftpd.service'
  
# systemctlstart vsftpd
 
//查看目前的状态
# systemctlstatus vsftpd
vsftpd.service - Vsftpd ftp daemon
   Loaded:loaded (/usr/lib/systemd/system/vsftpd.service; enabled)
   Active:active (running) since Mon 2014-08-11 19:57:12 CST; 22h ago
 Main PID:12733 (vsftpd)
   CGroup:/system.slice/vsftpd.service
          a””a”12733 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
  
systemd[1]: Starting Vsftpd ftp daemon...
systemd[1]: Started Vsftpd ftp daemon.
vsftpd[12738]: pam_userdb(vsftpd:auth): user'alice' granted access
vsftpd[12753]: pam_userdb(vsftpd:auth): user 'jack'granted access
systemd[1]: Started Vsftpd ftp daemon.

测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//测试匿名账户
# ftplocalhost
Trying ::1...
Connected to localhost (::1).
220 (vsFTPd 3.0.2)
Name(localhost:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftpls
229 Entering Extended Passive Mode (|||61057|).
150 Here comes the directory listing.
-rw-r--r--   1 0        0               9 Aug 11 11:45 open.txt
226 Directory send OK.
ftp> lcd/tmp
Local directory now /tmp
ftp> getopen.txt
localopen.txt remote: open.txt
229 Entering Extended Passive Mode (|||64276|).
150 Opening BINARY mode data connection foropen.txt (9 bytes).
226 Transfer complete.
9 bytes received in 0.000895 secs(10.06 Kbytes/sec)
ftp> bye
221 Goodbye.
  
 //测试本地账户
# ftplocalhost
Trying ::1...
Connected to localhost (::1).
220 (vsFTPd 3.0.2)
Name(localhost:root): alice
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftpls
229 Entering Extended Passive Mode (|||21750|).
150 Here comes the directory listing.
226 Directory send OK.
ftp> !ls/tmp
filetest1.txt     open.txt    systemd-private-9xPN7y  vmware-fonts0      vmware-installer1  vmware-root             vmware-tools-distrib
ks-script-_Yi85R SAMBA.docx  vmware-config0          vmware-installer0  vmware-installer2  vmware-root-2117481760  yum.log
ftp> lcd/tmp
Local directory now /tmp
ftp> putfiletest1.txt
local: filetest1.txt remote: filetest1.txt
229 Entering Extended Passive Mode (|||65399|).
150 Ok to send data.
226 Transfer complete.
9 bytes sent in 5.9e-05 secs (152.54 Kbytes/sec)
ftp> bye
221 Goodbye.

本文出自 “李豪” 博客,请务必保留此出处http://leaus.blog.51cto.com/9273485/1540773

CentOS7安装配置FTP服务器的更多相关文章

  1. (7)centos7安装配置ftp服务器

    1.安装vsftpd yum install vsftpd -y 2.设置开机启动vsftpd ftp服务 systemctl enable vsftpd.service 3.启动vsftpd服务 s ...

  2. Centos7安装vsftpd (FTP服务器)

    Centos7安装vsftpd (FTP服务器) 原文链接:https://www.jianshu.com/p/9abad055fff6 TyiMan 关注 2016.02.06 21:19* 字数 ...

  3. win7下安装配置ftp服务器

    1. win7操作系统自带了ftp组件,所以不需要另外下载.只需要在控制面板中,添加或删除组件中启用即可. 2. 在管理上,ftp和iis是属于同一个目录的.ftp也可以算是internet info ...

  4. CentOS8.0-1905安装配置ftp服务器

    关键词:CentOS8/RHEL8;安装配置FTP/安装配置VSFTPD;被动模式/PASV##CentOS8.0-1905发布后,尝试将FTP服务器迁移至新版本的CentOS中,但是测试过程中,在防 ...

  5. CentOS 7安装配置FTP服务器

    CentOS 7下FTP服务器的安装配置. 假设我们有以下要求 路径 权限 备注 /ftp/open 公司所有人员包括来宾均可以访问 只读 /ftp/private 仅允许Alice.Jack.Tom ...

  6. centos7下配置ftp服务器

    第一步,安装vsftpd这款ftp服务器软件,yum install -y vsftpd 第二步,设置vsftpd服务开机自启动,然后重启服务,查看ftp服务端口,centos6命令如下: #chkc ...

  7. 安装配置ftp服务器

    1.安装ftp服务 检查是否安装vsftpd rpm -qa|grep vsftpd 安装 vsftpd yum -y install vsftpd 2.配置 编辑 文件 /etc/vsftpd/vs ...

  8. vps建站教程 CentOS6如何安装配置FTP服务器

    通过之前的几篇文章,我们都知道了如何配置PHP环境,也知道如何保护我们的vps以及如何绑定多个域名建设多个网站.有时候我们为了让我们的朋友也能用我们的vps建站又不想给他们太多权限,有时候我们想要当个 ...

  9. CentOS7安装配置SAMBA服务器

    假设我们有这样一个场景 共享名 路径 权限 SHAREDOC /smb/docs 所有人员包括来宾均可以访问 RDDOCS /smb/tech 仅允许特定组的用户进行读写访问 特定组的组名为RD,目前 ...

随机推荐

  1. Daily Scrum6

    今天我们小组开会内容分为以下部分: part 1: Anti-spam and anti-abuse module模块总结: part 2: 部分优化代码的展示于交流: part 3:针对用户积分模块 ...

  2. android开发 替换bitmap中的颜色值

    /** * 将bitmap中的某种颜色值替换成新的颜色 * @param bitmap * @param oldColor * @param newColor * @return */ public ...

  3. HDU 5446 Unknown Treasure Lucas+中国剩余定理

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5446 Unknown Treasure 问题描述 On the way to the next se ...

  4. mysql导出导入某张表

    一般表数据少的话都用图形界面了,看着比较方便. 如果表中数据比较多,用图形界面极容易卡死,这个时候就要用到命令行了. 用命令行导出导入大量数据还是比较快的,方法如下: 导出库db1中的表table1: ...

  5. IE 选择文字后 显示小箭头 加速按钮

    IE - 工具 - Internet选项 - 高级 - 不选择<在选择是显示加速按钮>选项就可以了.

  6. PE文件结构学习

    PE:Portable Executable File Format(可移植的执行体).Windows平台主流可执行文件格式..exe与.dll文件都是PE格式.32位的叫做PE32,64位的叫做PE ...

  7. .NET设计模式(12):外观模式(Façade Pattern)(转)

    概述 在软件开发系统中,客户程序经常会与复杂系统的内部子系统之间产生耦合,而导致客户程序随着子系统的变化而变化.那么如何简化客户程序与子系统之间的交互接口?如何将复杂系统的内部子系统与客户程序之间的依 ...

  8. HDOJ 1428 漫步校园

    漫步校园 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...

  9. linux 上传/下载文件到windows工具

    一般来说,linux服务器大多是通过ssh客户端来进行远程的登陆和管理的,使用ssh登陆linux主机以后,如何能够快速的和本地机器进行文件的交互呢,也就是上传和下载文件到服务器和本地:   与ssh ...

  10. solr的collection,shard,replica,core概念

    一.collection 1.由多个cores组成一个逻辑索引叫做一个collection.一个collection本质上是一个可以跨越多个核的索引,同时包含冗余索引. 2.collection由不同 ...