ubuntu ftp服务器

In this tutorial, let’s learn how to install FTP server on Ubuntu. FTP or File Transfer Protocol is a protocol used to transfer files between two remote servers over the network.

在本教程中,让我们学习如何在Ubuntu上安装FTP服务器。 FTP或文件传输协议是用于在网络上的两个远程服务器之间传输文件的协议。

Just like HTTP is used to transfer data over the network through web browsers, FTP is commonly found being used by command-line users.

就像HTTP用于通过Web浏览器在网络上传输数据一样,FTP通常被命令行用户使用。

When you wish to install FTP server on Ubuntu, you have got a variety of open source FTP servers to choose from. However, for this tutorial, we will install the vsftpd (Very Secure FTP Daemon) server on our system.

当您希望在Ubuntu上安装FTP服务器时,您可以选择多种开源FTP服务器。 但是,对于本教程,我们将在系统上安装vsftpd(非常安全的FTP守护程序)服务器。

在Ubuntu上安装FTP服务器需要什么? (What’s needed to Install FTP Server on Ubuntu?)

This tutorial was made with an Ubuntu 18.04 running system. However, the same instructions will work on Ubuntu 16.04 and Debian based distributions like Elementary OS, Linux Mint and Debian.

本教程是使用Ubuntu 18.04运行系统制作的。 但是,相同的说明也适用于Ubuntu 16.04和基于Debian的发行版,例如Elementary OS,Linux Mint和Debian。

You would also need a non-root user with sudo privileges to follow this tutorial where we install FTP server on Ubuntu.

您还需要一个具有sudo特权的非root用户来遵循本教程,在本教程中,我们在Ubuntu上安装FTP服务器。

在Ubuntu上安装FTP服务器的步骤 (Steps to Install FTP Server on Ubuntu)

To install FTP server on Ubuntu, you don’t need to download anything. This is because the FTP server package comes with the default Ubuntu repository. The package that we’ll use is named vsftpd and can be accessed using the apt command.

要在Ubuntu上安装FTP服务器,您无需下载任何内容。 这是因为FTP服务器软件包随附于默认的Ubuntu存储库。 我们将使用的软件包名为vsftpd ,可以使用apt命令进行访问。

1.更新和升级存储库 (1. Update and Upgrade Repositories)

Before we begin to install FTP server on Ubuntu, we need to update our default repositories using the apt package management service.

在开始在Ubuntu上安装FTP服务器之前,我们需要使用apt软件包管理服务更新默认存储库。

To do this, you need to open the terminal on your Ubuntu system and type the following.

为此,您需要在Ubuntu系统上打开终端并输入以下内容。


sudo apt update && sudo apt upgrade

These commands update the Ubuntu repositories with the latest available repositories for your system.

这些命令使用系统的最新可用存储库更新Ubuntu存储库。

Now, this ensures that we will get the latest version of the vsftpd package when we install the FTP server on our system.

现在,这确保了在系统上安装FTP服务器时我们将获得最新版本的vsftpd软件包。

2.安装vsftpd软件包 (2. Installing the vsftpd package)

Now that we understand what an FTP server does, and have covered the prerequisites, it is time to install FTP server on our system. To do so, you need to follow the following steps.

既然我们了解了FTP服务器的功能,并且已经满足了先决条件,那么现在该在我们的系统上安装FTP服务器了。 为此,您需要遵循以下步骤。

Now that we have the desired repository, we can proceed with the tutorial. We will use the apt package management service to install FTP server on Ubuntu.

现在我们有了所需的存储库,我们可以继续进行本教程。 我们将使用apt软件包管理服务在Ubuntu上安装FTP服务器。

To do so, we enter the following in our terminal. You might be prompted to enter your user password to continue.

为此,我们在终端中输入以下内容。 可能会提示您输入用户密码以继续。


sudo apt install vsftpd

When you enter this command in your command line, this is what you should expect to see as the output on your screen.

当您在命令行中输入此命令时,这就是您期望在屏幕上看到的输出。

This command will tell the apt package manager to fetch the vsftpd package from our system repository.

此命令将告诉apt软件包管理器从我们的系统信息库中获取vsftpd软件包。

3.验证我们的安装 (3. Verifying our installation)

Once we install FTP server on Ubuntu, We can verify this by asking the terminal for the status of our vsftpd service. To do so, we enter this in our terminal.

在Ubuntu上安装FTP服务器后,我们可以通过询问终端vsftpd服务的状态来验证这一点。 为此,我们在终端中输入。


sudo systemctl status vsftpd
Vsftpd Service Status 1
Vsftpd服务状态1

This will fetch the details of the current status of the FTP server on our system. If we made no mistakes, the current status of our vsftpd service should be ‘running’ as seen in the screenshot above.

这将获取我们系统上FTP服务器当前状态的详细信息。 如果我们没有记错的话,我们的vsftpd服务的当前状态应该是“正在运行”,如上面的屏幕快照所示。

在Ubuntu上配置FTP服务器 (Configuring your FTP server on Ubuntu)

When you install FTP server on Ubuntu, you need to configure it before it can be used.

在Ubuntu上安装FTP服务器时,需要对其进行配置才能使用。

1.创建默认配置的备份 (1. Create a Backup of the Default Configuration)

Before we make any custom configurations, it is a recommended practice to create a copy of the default vsftpd configuration file as a backup in case we want to reset our configuration.

在进行任何自定义配置之前,建议做法是创建默认vsftpd配置文件的副本作为备份,以防我们想重置配置。

This can be done using the cp command as shown below.

可以使用cp命令完成此操作,如下所示。


sudo cp /etc/vsftpd.conf /etc/vsftpd.conf_backup

2.添加自定义配置 (2. Add Custom Configuration )

Now that we have a backup, we can start customizing the vsftpd configuration file. Let’s open the configuration file using the nano editor. You need to use this command to do so.

现在我们有了备份,我们可以开始自定义vsftpd配置文件了。 让我们使用nano编辑器打开配置文件。 您需要使用此命令。


sudo nano /etc/vsftpd.conf

Now we edit the configuration file to make necessary changes. The below table contains all the edits we make in this tutorial and what they do.

现在,我们编辑配置文件以进行必要的更改。 下表包含我们在本教程中所做的所有编辑及其作用。

Edit Result
anonymous_enable=NO
local_enable=YES
These block access for anonymous users, while enabling local users to access the FTP server.
write_enable=YES This allows changes to the filesystem when you upload or delete something through the FTP server.
chroot_local_user=YES This prevents a user from accessing files beyond their home directory. 
user_sub_token=$USER
local_root=/home/$USER/ftp
When chroot is enabled, vsftpd doesn’t allow uploads to prevent security risks. This creates an ftp directory in the user home to serve as the chroot. Later, we can create a new writable directory for the uploads.
pasv_min_port=30000
pasv_max_port=31000
This assigns the ports between the range 30000 and 31000 for passive FTP connections.
编辑 结果
onymous_enable =否
local_enable =是
这些阻止匿名用户访问,同时允许本地用户访问FTP服务器。
write_enable = YES 通过FTP服务器上载或删除某些内容时,这允许更改文件系统。
chroot_local_user =是 这样可以防止用户访问其主目录之外的文件。
user_sub_token = $ USER
local_root = / home / $ USER / ftp
启用chroot时,vsftpd不允许上传以防止安全风险。 这将在用户主目录中创建一个ftp目录以用作chroot。 稍后,我们可以为上传创建一个新的可写目录。
pasv_min_port = 30000
pasv_max_port = 31000
这将在30000到31000范围内为被动FTP连接分配端口。

You can also specify certain users that can login while denying anyone who’s not on the list by creating a file “/etc/vsftpd.allowed_users” and adding the usernames here.

您还可以通过创建文件“ /etc/vsftpd.allowed_users ”并在此处添加用户名,来指定某些可以登录而拒绝不在列表中的用户的用户。

Once you have that set up, you can add the following lines to the configuration file:

设置完成后,可以将以下行添加到配置文件:


userlist_enable=YES
userlist_file=/etc/vsftpd.allowed_users

3.打开用于传入FTP请求的端口 (3. Open Ports for Incoming FTP Requests)

Now, we have been successful to install FTP server on Ubuntu and set some configurations.

现在,我们已成功在Ubuntu上安装FTP服务器并进行了一些配置。

It’s time to update the firewall settings using the ufw command so that our FTP server can listen through port numbers 20 and 21.

现在该使用ufw命令更新防火墙设置了,以便我们的FTP服务器可以侦听端口号20和21。

We will also open the port range 30000 to 31000, which we assigned for passive FTP connections. Enter these commands in your terminal.

我们还将打开为被动FTP连接分配的端口范围30000至31000。 在终端中输入这些命令。


sudo ufw allow 30000:31000/tcp
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp

Now port 20 and 21 will work as listening ports for our FTP server. We will now check the status of ufw using the following command so that its rules are updated.

现在,端口20和21将用作FTP服务器的侦听端口。 现在,我们将使用以下命令检查ufw的状态,以便更新其规则。


sudo ufw status
Ufw Allow Ports
Ufw允许端口

4.重新启动FTP服务器 (4. Restart FTP Server)

Finally, we will use systemctl to restart the vsftpd service.

最后,我们将使用systemctl重新启动vsftpd服务。


sudo systemctl restart vsftpd

Now we are done with our quest to install FTP server on Ubuntu. Go ahead and connect to your FTP server

现在我们完成了在Ubuntu上安装FTP服务器的任务。 继续并连接到您的FTP服务器

结论 (Conclusion)

While newer and faster protocols exist now, FTP remains relevant for legacy support and workplaces with highly specific requirements.

尽管现在存在更新更快的协议,但FTP仍然与传统支持和具有高度特定要求的工作场所相关。

It’s an important thing to keep in mind that FTP is an unencrypted network protocol by default.

请记住,默认情况下,FTP是未加密的网络协议,这一点很重要。

Hence, it is not a recommended protocol to be used for securely transferring data without sufficient safety mechanisms in place.

因此,在没有适当的安全机制的情况下,不建议将协议用于安全地传输数据。

This tutorial aimed to help you install FTP server on Ubuntu and set some basic configuration in place.

本教程旨在帮助您在Ubuntu上安装FTP服务器并设置一些基本配置。

翻译自: https://www.journaldev.com/38450/install-ftp-server-on-ubuntu

ubuntu ftp服务器

ubuntu ftp服务器_如何在Ubuntu上安装FTP服务器?相关推荐

  1. heroku服务器_如何在Heroku上使用Express服务器部署React应用

    heroku服务器 by Ashish Nandan Singh 通过Ashish Nandan Singh 如何在Heroku上使用Express服务器部署React应用 (How to deplo ...

  2. _如何在 Linux 上安装 Minecraft 服务器

    Minecraft是一个流行的沙箱独立游戏,由瑞典程序员Markus "Notch" Perssion首先创造,后来由Mojang开发并发布.这是一款关于打碎和放置砖块的游戏.首先 ...

  3. ezboot not found 虚拟机安装_如何在 Linux 上安装 Minecraft 服务器

    Minecraft是一个流行的沙箱独立游戏,由瑞典程序员Markus "Notch" Perssion首先创造,后来由Mojang开发并发布.这是一款关于打碎和放置砖块的游戏.首先 ...

  4. 我的世界服务器linux,如何在Linux上安装Minecraft服务器?

    "我的世界Minecraft"是一个人们可以在各种游戏主机和计算机上玩的主流游戏. 截止至 2016 年 6 月,在各种平台上已经售出了超过十亿六千万份.因其受欢迎,你可能想在家里 ...

  5. windows7安dns服务器_在Windows 7 上安装DNS服务器bind9方法详解

    本文主要介绍在WIN7上安装bind9 DNS服务器的方法,非常详细希望对大家有所帮助 本文主要介绍在WIN7上利用ntbind部署DNS服务器的方法.ntbind是Bind的Windows版本, 1 ...

  6. linux使用ftp命令_如何在Linux上使用FTP命令

    linux使用ftp命令 Fatmawati Achmad Zaenuri/Shutterstock.com Fatmawati Achmad Zaenuri / Shutterstock.com T ...

  7. linux系统管理与服务器配置高志君_如何在 Linux 上安装、配置 NTP 服务器和客户端?...

    你也许听说过这个词很多次或者你可能已经在使用它了.在这篇文章中我将会清晰的告诉你 NTP 服务器和客户端的安装. -- Magesh Maruthamuthu 你也许听说过这个词很多次或者你可能已经在 ...

  8. linux上开发应用程序_如何在Linux上安装软件应用程序

    linux上开发应用程序 如何在Linux上安装应用程序? 与许多操作系统一样,该问题不仅有一个答案. 应用程序可以来自许多来源-几乎无法计数-每个开发团队都可以以自己认为最佳的方式交付软件. 知道如 ...

  9. java安装_如何在 Mac 上安装 Java | Linux 中国

    macOS 用户可以运行 Java 的开源版本,以及用于云原生开发的新框架. 来源:https://linux.cn/article-12393-1.html 作者:Daniel Oh 译者:MCGA ...

最新文章

  1. java 8 stream_Java 8 Stream示例
  2. charles iPhone抓包步骤 Fiddler
  3. 阿里财报揭秘:阿里巴巴最忙的人这一年都干了啥
  4. 001 - CMake 安装
  5. android auto能用酷狗,完美支持Android车载设备,酷狗音乐pad版使用教程
  6. pgadmin 转成oracle,pgAdmin快速备份还原数据库
  7. C#数据库编程实战经典
  8. c语言乐谱编辑软件怎么用的,雅乐简谱这个软件怎么使用?
  9. 互斥锁、自旋锁、读写锁和文件锁
  10. 【校园卡】2020校园卡最近消息,电信联通默认都增加10G全国流量
  11. 免费个人商城系统源码推荐
  12. 7_文件系统与磁盘分区
  13. 1028: C语言程序设计教程(第三版)课后习题8.1用函数求公约数
  14. 网易我的世界服务器正在维护,网易《我的世界》Hypixel中国版服务器将停止运营...
  15. iphone开发 调用相机拍照
  16. 高精度乘法(c++)
  17. Google翻译逆天了 留着心情不好的时候用
  18. [蓝桥杯][算法提高][vip] 阮小二买彩票
  19. could not open selected vm debug port 8700
  20. 《SaltStack技术入门与实践》—— Renderer组件

热门文章

  1. 三大框架ssh整合(一)
  2. 【BZOJ1061/3265】[Noi2008]志愿者招募/志愿者招募加强版 单纯形法
  3. Visual Studio 2013/2015/2017快捷键(转)
  4. Shell-杀死指定进程
  5. 设计模式--适配器1模式实现C++
  6. saltstack 远程执行之返回写入到mysql
  7. UE4删除C++Classes下的类
  8. MyEclipse项目里面出现红叉的解决方案?
  9. 简单介绍一下vue2.0
  10. java并发编程(二)synchronized