假设我们有以下要求

路径 权限 备注
/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. Java缓冲流细节

    FileOutPutStream继承OutputStream,并不提供flush()方法的重写所以无论内容多少write都会将二进制流直接传递给底层操作系统的I/O,flush无效果.而Buffere ...

  2. Kibana4学习<一>

    Kibana4 安装方式依然简单,你可以在几分钟内安装好 Kibana 然后开始探索你的 Elasticsearch 索引.只需要预备: Elasticsearch 1.4.4 或者更新的版本 一个现 ...

  3. android 开发 对图片编码,并生成gif图片

    demo场景: 将2张静态的png格式图片组合生成一个gif图片,间隔500毫秒,关键类:AnimatedGifEncoder 如需要解析gif获取每帧的图片,可参考上一篇博客:<android ...

  4. Grails 1.2参考文档速读(10):Controller

    转载:http://keyvalue.blog.51cto.com/1475446/303260       从本篇起,我们将开始进入Grails的Web层,首先让我们从Controller说起. G ...

  5. PHP去除数组中重复数据的两个例子

    例一: <?php$input = array("a" => "green","", "red"," ...

  6. IIS和MVC

    现象:MVC项目部署到IIS(7.5)后,浏览时只显示文件目录,不是网站 解决办法 1.服务器安装程序对应的Framework版本 2.服务器安装程序对应的MVC版本 3.安装CGI和ISAPI扩展: ...

  7. Eclipse支持Jquery代码提示(JqeuryWTP)

    问题描述:        Eclipse支持Jquery代码提示   问题解决: 下载 JqueryWTP.jar文件         文件替换        在Eclipse/plugin 路径下, ...

  8. Matlab设置网格线密度(坐标精度)

    1.不精确 set(gca,'XMinorTick','on') 这样的话知识x轴显示了细的密度,网格线并没有变. 2.精确 set(gca,'xtick',-1:0.1:1); set(gca,'y ...

  9. orbis 链接 .a的问题

    orbis-clang.exe :error: no such file or directory : libppfxd_delta.a 这个东西真是见鬼 明明在那里就是说找不到 在依赖里libppf ...

  10. 1-Highcharts 3D图之普通3D柱状图与带空值

    <!DOCTYPE> <html lang='en'> <head> <title>1-Highcharts 3D图之普通3D柱状图与带空值</t ...