前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 7.2 部署文件服务器

CentOS 7.2 部署文件服务器

作者头像
shaonbean
发布2019-05-26 09:44:17
2.3K0
发布2019-05-26 09:44:17
举报
文章被收录于专栏:运维前线运维前线

版权声明:本文为木偶人shaon原创文章,转载请注明原文地址,非常感谢。 https://cloud.tencent.com/developer/article/1434737

Vsftpd 简介

  • vsftpd 是“very secure FTP daemon”的缩写,安全性是它的一个最大的特点。vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以运行在诸如 Linux、BSD、Solaris、 HP-UNIX等系统上面,是一个完全免费的、开放源代码的ftp服务器软件,支持很多其他的 FTP 服务器所不支持的特征。比如:非常高的安全性需求、带宽限制、良好的可伸缩性、可创建虚拟用户、支持IPv6、速率高等。
  • Vsftpd传送门:http://freecode.com/projects/vsftpd/
  • Vsftpd下载地址:https://security.appspot.com/vsftpd.html

Vsftpd 安装

安装Vsftpd配置FTP服务器。

> [1]配置Vsftpd。

[root@linuxprobe ~]# yum -y install vsftpd
[root@linuxprobe ~]# vi /etc/vsftpd/vsftpd.conf
# line 12: no anonymous

anonymous_enable=NO
# line 82,83: uncomment ( allow ascii mode )

ascii_upload_enable=YES
ascii_download_enable=YES
# line 100, 101: uncomment ( enable chroot )

chroot_local_user=YES
chroot_list_enable=YES
# line 103: uncomment ( specify chroot list )

chroot_list_file=/etc/vsftpd/chroot_list
# line 109: uncomment

ls_recurse_enable=YES
# line 114: change ( if use IPv4 )

listen=YES
# line 123: change ( turn to OFF if it's not need )

listen_ipv6=NO
# add follows to the end

# specify root directory ( if don't specify, users' home directory become FTP home directory)

local_root=public_html
# use localtime

use_localtime=YES
# turn off for seccomp filter ( if you cannot login, add this line )

seccomp_sandbox=NO
[root@linuxprobe ~]# vi /etc/vsftpd/chroot_list
# add users you allow to move over their home directory

cent
[root@linuxprobe ~]# systemctl start vsftpd

[root@linuxprobe ~]# systemctl enable vsftpd

[2]如果Firewalld正在运行,请允许FTP服务。    

[root@dlp ~]# firewall-cmd --add-service=ftp --permanent
success
[root@dlp ~]# firewall-cmd --reload
success

[3]如果启用了SELinux,则更改布尔设置。    
[root@dlp ~]# setsebool -P ftpd_full_access on 

ProFTPD 简介

  • ProFTPD:一个Unix平台上或是类Unix平台上(如Linux, FreeBSD等)的FTP服务器程序,它是在自由软件基金会的版权声明(GPL)下开发、发布的免费软件,也就是说任何人只要遵守GPL版权声明,都可以随意修改源始码。
  • ProFTPD官方地址:http://www.proftpd.org/
  • ProFTPD官方文档:http://www.proftpd.org/docs/

ProFTPD 安装

  • 安装ProFTPD以配置FTP服务器。
[1] Install and configure ProFTPD.
# install from EPEL
[root@linuxprobe ~]# yum --enablerepo=epel -y install proftpd
[root@linuxprobe ~]# vi /etc/proftpd.conf
# line 77: change to your own hostname
ServerName       "www.srv.world
"
# line 79: change to your email address

ServerAdmin       root@srv.world
# line 113: add
# get access log & get auth log
ExtendedLog     /var/log/proftpd/access.log WRITE,READ default
ExtendedLog     /var/log/proftpd/auth.log AUTH auth
[root@linuxprobe ~]# vi /etc/ftpusers
# add users you prohibit to FTP access
test
[root@linuxprobe ~]# systemctl start proftpd
[root@linuxprobe ~]# systemctl enable proftpd

# 在另外的服务器上面设置Selinux
[2] If Firewalld is running, allow FTP service.
[root@vdevops ~]# firewall-cmd --add-service=ftp --permanent
success
[root@vdevops ~]# firewall-cmd --reload
success
[3] If SELinux is enabled, change boolean setting.
[root@vdevops ~]# setsebool -P ftpd_full_access on 

PureFTPd 简介

PureFTPd 安装

  • 安装Pure-FTPd以配置FTP服务器
[1] Install Pure-FTPd.
# install from EPEL
[root@linuxprobe ~]# yum --enablerepo=epel -y install pure-ftpd
[root@linuxprobe ~]# vi /etc/pure-ftpd/pure-ftpd.conf
# line 77: change (no Anonymous)
NoAnonymous       yes
# line 453: uncomment (if you use only IPv4)
IPV4Only       yes
# line 460: uncomment (if you use only IPv6)
IPV6Only       yes
[root@linuxprobe ~]# systemctl start pure-ftpd
[root@linuxprobe ~]# systemctl enable pure-ftpd
[2] If Firewalld is running, allow FTP service.
[root@vdevops ~]# firewall-cmd --add-service=ftp --permanent
success
[root@vdevops ~]# firewall-cmd --reload
success
[3] If SELinux is enabled, change boolean setting.
[root@vdevops ~]# setsebool -P ftpd_full_access on 

FTP Client : CentOS

  • 以CentOS为例, 配置客户端计算机以连接到FTP服务器
[1]  安装FTP客户端   .
[root@vdevops ~]# yum -y install lftp
[2]  默认情况下禁止使用root帐户连接,因此可以使用普通用户访问FTP服务器   .
# lftp [option] [hostname]
[redhat@vdevops ~]$ lftp -u wang linuxprobe.org
Password:     # password of the user
lftp wang@linuxprobe.org:~>
# 显示FTP服务器上的当前目录
lftp wang@linuxprobe.org:~> pwd
ftp://wang@linuxprobe.org
# 显示本地服务器上的当前目录
lftp wang@linuxprobe.org:~> !pwd
/home/redhat
#  在FTP服务器上显示当前目录中的文件
lftp wang@linuxprobe.org:~> ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py
# 显示本地服务器上当前目录中的文件
lftp wang@linuxprobe.org:~> !ls -l
total 12
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:30 redhat.txt
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:59 test2.txt
-rw-rw-r-- 1 redhat redhat 10 Jul 20 14:59 test.txt
# 更改目录
lftp wang@linuxprobe.org:~> cd public_html
lftp wang@linuxprobe.org:~/public_html> pwd
ftp://wang@linuxprobe.org/%2Fhome/wang/public_html
# 将文件上传到FTP服务器
# “-a”表示ascii模式(默认为二进制模式)
lftp wang@linuxprobe.org:~> put -a redhat.txt
22 bytes transferred
Total 2 files transferred
lftp wang@linuxprobe.org:~> ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r--    1 1000     1000           10 Jul 20 17:01 redhat.txt
-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py
-rw-r--r--    1 1000     1000           10 Jul 20 17:01 test.txt
# 上传一些文件到FTP服务器
lftp wang@linuxprobe.org:~> mput -a test.txt test2.txt
22 bytes transferred
Total 2 files transferred
lftp wang@linuxprobe.org:~> ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py
-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt
-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test2.txt
# 从FTP服务器下载文件
# “-a”表示ascii模式(默认为二进制模式)
lftp wang@linuxprobe.org:~> get -a test.py
416 bytes transferred
# 从FTP服务器下载一些文件
lftp wang@linuxprobe.org:~> mget -a test.txt test2.txt
20 bytes transferred
Total 2 files transferred
# 在FTP服务器上的当前目录中创建一个目录
lftp wang@linuxprobe.org:~> mkdir testdir
mkdir ok, `testdir' created
lftp wang@linuxprobe.org:~> ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py
-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt
-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test2.txt
drwxr-xr-x    2 1000     1000            6 Jul 20 17:16 testdir
226 Directory send OK.
# 删除FTP服务器上当前目录的目录
lftp wang@linuxprobe.org:~> rmdir testdir
rmdir ok, `testdir' removed
lftp wang@linuxprobe.org:~> ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py
-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt
-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test2.txt
# 删除FTP服务器上当前目录中的文件
lftp wang@linuxprobe.org:~> rm test2.txt
rm ok, `test2.txt' removed
lftp wang@linuxprobe.org:~> ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py
-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt
# 删除FTP服务器上当前目录中的一些文件
lftp wang@linuxprobe.org:~> mrm redhat.txt test.txt
rm ok, 2 files removed
lftp wang@linuxprobe.org:~> ls
drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html
# 使用“![command]”执行命令
lftp wang@linuxprobe.org:~> !cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
...
...
redhat:x:1001:1001::/home/redhat:/bin/bash
# exit
lftp wang@linuxprobe.org:~> quit
221 Goodbye.
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年11月04日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Vsftpd 简介
  • Vsftpd 安装
  • ProFTPD 简介
  • ProFTPD 安装
  • PureFTPd 简介
  • PureFTPd 安装
  • FTP Client : CentOS
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档