`
eimhee
  • 浏览: 2167883 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ubuntu 下安装FTP服务器VSFTPD

 
阅读更多

           File Transfer Protocol (FTP) is a TCP protocol for uploading and downloading files between computers. FTP works on a client/server model. The server component is called an FTP daemon. It continuously listens for FTP requests from remote clients. When a request is received, it manages the login and sets up the connection. For the duration of the session it executes any of commands sent by the FTP client.

Access to an FTP server can be managed in two ways:

  • Anonymous

  • Authenticated

In the Anonymous mode, remote clients can access the FTP server by using the default user account called "anonymous" or "ftp" and sending an email address as the password. In the Authenticated mode a user must have an account and a password. User access to the FTP server directories and files is dependent on the permissions defined for the account used at login. As a general rule, the FTP daemon will hide the root directory of the FTP server and change it to the FTP Home directory. This hides the rest of the file system from remote sessions.

vsftpd - FTP Server Installation

vsftpd is an FTP daemon available in Ubuntu. It is easy to install, set up, and maintain. To install vsftpd you can run the following command:

sudo apt-get install vsftpd

Anonymous FTP Configuration

By default vsftpd is configured to only allow anonymous download. During installation a ftp user is created with a home directory of /home/ftp. This is the default FTP directory.

If you wish to change this location, to /srv/ftp for example, simply create a directory in another location and change the ftp user's home directory:

sudo mkdir /srv/ftp
sudo usermod -d /srv/ftp ftp 

After making the change restart vsftpd:

sudo /etc/init.d/vsftpd restart

Finally, copy any files and directories you would like to make available through anonymous FTP to /srv/ftp.

User Authenticated FTP Configuration

To configure vsftpd to authenticate system users and allow them to upload files edit /etc/vsftpd.conf:

local_enable=YES
write_enable=YES

Now restart vsftpd:

sudo /etc/init.d/vsftpd restart

Now when system users login to FTP they will start in their home directories where they can download, upload, create directories, etc.

Similarly, by default, the anonymous users are not allowed to upload files to FTP server. To change this setting, you should uncomment the following line, and restart vsftpd:

anon_upload_enable=YES
 
[Warning]

Enabling anonymous FTP upload can be an extreme security risk. It is best to not enable anonymous upload on servers accessed directly from the Internet.

The configuration file consists of many configuration parameters. The information about each parameter is available in the configuration file. Alternatively, you can refer to the man page, man 5 vsftpd.conf for details of each parameter.

Securing FTP

There are options in /etc/vsftpd.conf to help make vsftpd more secure. For example users can be limited to their home directories by uncommenting:

chroot_local_user=YES

You can also limit a specific list of users to just their home directories:

chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

After uncommenting the above options, create a /etc/vsftpd.chroot_list containing a list of users one per line. Then restart vsftpd:

sudo /etc/init.d/vsftpd restart

Also, the /etc/ftpusers file is a list of users that are disallowed FTP access. The default list includes root, daemon, nobody, etc. To disable FTP access for additional users simply add them to the list.

FTP can also be encrypted using FTPS. Different from SFTP, FTPS is FTP over Secure Socket Layer (SSL). SFTP is a FTP like session over an encrypted SSH connection. A major difference is that users of SFTP need to have a shell account on the system, instead of a nologin shell. Providing all users with a shell may not be ideal for some environments, such as a shared web host.

To configure FTPS, edit /etc/vsftpd.conf and at the bottom add:

ssl_enable=Yes

Also, notice the certificate and key related options:

rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

By default these options are set the certificate and key provided by the ssl-cert package. In a production environment these should be replaced with a certificate and key generated for the specific host. For more information on certificates see the section called “Certificates”.

Now restart vsftpd, and non-anonymous users will be forced to use FTPS:

sudo /etc/init.d/vsftpd restart

To allow users with a shell of /usr/sbin/nologin access to FTP, but have no shell access, edit /etc/shells adding the nologin shell:

# /etc/shells: valid login shells
/bin/csh
/bin/sh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen
/usr/sbin/nologin

This is necessary because, by default vsftpd uses PAM for authentication, and the /etc/pam.d/vsftpd configuration file contains:

auth    required        pam_shells.so

The shells PAM module restricts access to shells listed in the /etc/shells file.

Most popular FTP clients can be configured connect using FTPS. The lftp command line FTP client has the ability to use FTPS as well.                  

 

 

 

use root to login ftp

vi /etc/ftpusers

then remove root from the file

 

 

分享到:
评论

相关推荐

    Ubuntu16.04离线安装包vsftpd

    VSFTPD,全称为Very Secure FTP Daemon,是一款安全且功能强大的FTP服务器软件。在Ubuntu 16.04系统中,如果你需要在没有网络连接的情况下安装它,可以采用离线安装的方式。下面将详细介绍这个过程。 首先,你需要...

    ubuntu server 安装vsftpd FTP服务器linux服务器应用 电脑资料.doc.docx

    Ubuntu Server 安装 VSFTPD FTP 服务器 Linux 服务器应用电脑资料 安装 VSFTPD FTP 服务器是 Linux 服务器应用电脑资料中的一部分,本文将详细介绍如何在 Ubuntu Server 10.4 上安装 VSFTPD FTP 服务器。 一、安装...

    基于Ubuntu的FTP服务器

    首先,FTP服务器的核心在于一个名为“vsftpd”(Very Secure FTP Daemon)的开源软件,它在Ubuntu中广泛被使用。在Ubuntu 22.04上安装vsftpd非常简单,可以通过命令行执行以下操作: ```shell sudo apt update sudo...

    如何在ubuntu中安装设置ftp服务器

    ### 如何在Ubuntu中安装与配置FTP服务器 #### 一、引言 FTP(File Transfer Protocol)即文件传输协议,是一种用于在网络上进行文件传输的标准协议。在Linux系统中,特别是Ubuntu这样的发行版上,安装和配置FTP...

    ubuntu_vsftpd FTP服务器配置学习札记

    通过以上步骤,你应该能够成功地在Ubuntu上配置和管理一个安全的vsftpd FTP服务器。记住,安全性和稳定性是首要考虑的因素,因此在设置过程中要谨慎处理每一个细节。持续学习和实践,以优化你的FTP服务器配置。

    Ubuntu Linux上安装SSH和Vsftpd的方法

    Vsftpd 是一个轻量级的 FTP 服务器软件,它在 Ubuntu 中是可用的。 Vsftpd 的安装非常简单,只需要使用以下命令: sudo apt-get install vsftpd 安装完成后,您可以配置 Vsftpd 服务器以满足您的需求。 Vsftpd ...

    ubuntu搭建ftp服务器

    在Ubuntu系统中搭建FTP服务器,通常我们会选择使用`vsftpd`(Very Secure FTP Daemon)这个轻量级且安全的FTP服务软件。`vsftpd`因其安全性高、配置简单而受到广泛欢迎。以下是如何在Ubuntu 16.04上安装、配置以及...

    Ubuntu下FTP服务器搭建+DNS服务器搭建

    教程文件"Ubuntu下FTP服务器搭建+DNS服务器搭建教程.pdf"可能包含了更详细的步骤和注意事项,你可以参考其中内容进行操作。"www.linuxidc.com.png"可能是某个网站的logo或截图,与本次话题关联性不强,这里不再赘述...

    Ubuntu 下安装和配置 FTP服务器

    为了解决这个问题,本教程将指导你如何在Ubuntu系统中安装和配置VSFTPD,一个高度安全的FTP服务器。 首先,你需要更新Ubuntu系统的软件包列表,并安装VSFTPD(Very Secure FTP Daemon)。执行以下命令: ```bash ...

    Shell脚本搭建FTP服务器(vsftpd)

    总结来说,这个Shell脚本提供了一种自动化搭建FTP服务器(使用vsftpd)的方法,包括安装必要的软件、创建用户数据库、配置PAM和vsftpd服务,以及设定用户权限。这个脚本适用于Ubuntu 13和Linux Mint 15,但对于其他...

    Ubuntu下安装、配置FTP服务

    ### Ubuntu下安装与配置FTP服务详解 在深入探讨如何在Ubuntu环境下搭建并配置FTP服务之前,让我们先简要回顾一下FTP的基本概念。FTP,全称为File Transfer Protocol(文件传输协议),是一种用于在网络上进行文件...

    Ubuntu 10.04 搭建vsftpd 2.2.2

    安装时,软件会创建一个配置文件“vsftpd.conf”在/etc 目录下,并创建一个系统用户“ftp”,该用户的密码为“ftp”。同时,软件还会在/srv 目录下创建一个 ftp 文件夹,该文件夹的所有者是“root”,群组是“ftp”...

    Ubuntu下FTP服务器搭建+DNS服务器搭建教程

    ### Ubuntu下FTP服务器搭建知识点 #### 一、更新源列表 - **操作步骤**:首先,需要通过终端更新源列表,确保系统能够访问最新的软件包信息。这一步非常重要,因为如果源列表没有更新,可能会遇到某些软件包无法...

    Ubuntu下Vsftpd服务器配置指南

    Vsftpd是一款在Linux系统上非常流行的FTP服务器软件,它以其高效性、安全性以及丰富的功能而受到广泛赞誉。根据给定内容,我们可以了解到Vsftpd采用了一种特殊的许可方式:您可以自由地拷贝、分发、呈现和表演Vsftpd...

    vsftpd3.0.5-tar.gz版本源码,在ubuntu20.4可以编译成功

    【FTP服务器程序——vsftpd 3.0.5源码在Ubuntu 20.4上的编译与应用】 FTP(File Transfer Protocol)是互联网上用于文件传输的标准协议,而vsftpd(Very Secure FTP Daemon)是Linux系统中最常用、安全性较高的FTP...

    linux下安装vsftpd服务

    Linux 下安装 vsftpd 服务 在 Linux 系统中,安装 vsftpd 服务可以提供 FTP 服务器功能,vsftpd 是目前 Linux 最好的 FTP 服务器工具之一,其中的 vs 就是“Very Secure”的缩写,表明该工具的最大优点就是安全。除...

    Ubuntu下ftp服务器配置方法

    本文将详细介绍如何在Ubuntu环境下安装与配置vsftpd(Very Secure FTP Daemon)作为FTP服务软件,并通过具体的步骤演示如何设置权限控制、安全策略以及性能优化等方面的内容。 #### 二、安装vsftpd 首先,我们需要...

    Centos 8 vsftpd多用户FTP服务器配置完美方案——同时解决PORT和PASV模式

    vsftpd是非常流行的FTP服务器软件,支持多种操作系统,包括CentOS、Ubuntu、Debian等。vsftpd支持多种认证方式,包括anonymous、local、virtual等。 配置vsftpd多用户FTP服务器 1. 切换到root用户,设置必须在root...

    【最新】Ubuntu下ftp服务器配置方法.doc

    Ubuntu系统自带的FTP服务器软件是vsftpd(Very Secure FTP Daemon)。下面将详细介绍如何在Ubuntu上安装和配置vsftpd服务器。 首先,安装vsftpd非常简单,只需在终端中输入以下命令: ``` sudo apt-get install ...

Global site tag (gtag.js) - Google Analytics