Linux Admin教程

Linux Admin FTP

在深入研究在 CentOS 上安装 FTP 之前,我们需要了解一下它的使用和安全性。 FTP 是一种非常有效且完善的协议,用于在 t 之间传输文件他计算机系统。 FTP 已经使用和改进了几十年。为了通过具有延迟的网络有效地传输文件或纯粹的速度,FTP 是一个不错的选择。比 SAMBA 或 SMB 更重要。
然而,FTP 确实存在一些安全问题。实际上,一些严重的安全问题。 FTP 使用非常弱的纯文本身份验证方法。正是因为这个原因,经过身份验证的会话应该依赖于 sFTP 或 FTPS,其中 TLS 用于登录和传输会话的端到端加密。
有了上述警告,普通的旧 FTP 在今天的商业环境中仍然可以使用。主要用途是匿名 FTP 文件存储库。在这种情况下,下载或上传文件无需身份验证。匿名 FTP 使用的一些示例是-
大型软件公司仍然使用匿名 ftp 存储库,允许互联网用户下载共享软件和补丁。 允许互联网用户上传和下载公共文档。 某些应用程序会通过 FTP 自动将加密的存档日志或配置文件发送到存储库。
因此,作为 CentOS 管理员,能够安装和配置 FTP 仍然是一项设计技能。
我们将使用名为 vsFTP 或非常安全的 FTP 守护程序的 FTP 守护程序。 vsFTP 已经在开发中使用了一段时间。它以安全、易于安装和配置以及可靠而著称。
第 1 步-使用 YUM 包管理器安装 vsFTPd。
[root@centos]# yum-y install vsftpd.x86_64
第 2 步-使用 systemctl 配置 vsFTP 以在启动时启动。
[root@centos]# systemctl start vsftpd 
[root@centos]# systemctl enable vsftpd 
Created symlink from /etc/systemd/system/multi-
user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
第 3 步-配置 FirewallD 以允许 FTP 控制和传输会话。
[root@centos]# firewall-cmd--add-service=ftp--permanent 
success 
[root@centos]#
确保我们的 FTP 守护进程正在运行。
[root@centos]# netstat-antup | grep vsftp 
tcp6       0       0 :::21       :::*       LISTEN       13906/vsftpd         
[root@centos]#
第 4 步-为匿名访问配置 vsFTPD。

创建根FTP目录

[root@centos]# mkdir /ftp

将 FTP 根的所有者和组更改为 ftp

[root@centos]# chown ftp:ftp /ftp
Set minimal permissions for FTP root:
[root@centos]# chmod-R 666 /ftp/
[root@centos]# ls-ld /ftp/
drw-rw-rw-. 2 ftp ftp 6 Feb 27 02:01 /ftp/
[root@centos]#
在这种情况下,我们授予用户对整个根 FTP 树的读/写访问权限。

配置/etc/vsftpd/vsftpd.conf"

[root@centos]# vim /etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. this sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ this: this example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
我们将要更改 vsftp.conf 文件中的以下指令。
通过取消注释anon_mkdir_write_enable=YES来启用匿名上传 chown 上传文件归系统所有 ftp 用户
chown_uploads = YES
chown_username = ftp 将vsftp使用的系统用户改为ftp用户:nopriv_user = ftp 设置用户在登录前阅读的自定义横幅。
ftpd_banner = 欢迎使用我们的匿名 FTP 存储库。所有连接都受到监控和记录。 让我们只设置 IPv4 连接-
listen = YES
listen_ipv6 = NO
现在,我们需要重新启动或 HUP vsftp 服务以应用我们的更改。
[root@centos]# systemctl restart vsftpd
让我们连接到我们的 FTP 主机并确保我们的 FTP 守护进程正在响应。
[root@centos rdc]# ftp 10.0.4.34 
Connected to localhost (10.0.4.34). 
220 Welcome to our Anonymous FTP Repo. All connections are monitored and logged. 
Name (localhost:root): anonymous 
331 Please specify the password. 
Password: 
'230 Login successful. 
Remote system type is UNIX. 
Using binary mode to transfer files. 
ftp>
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4