Configure the FTP server with vsftpd in Ubuntu

Source: Internet
Author: User
Configure the FTP server with vsftpd in Ubuntu

After working for a while, I found that although there are a lot of related tutorials on the Internet, it is either too simple to understand the content of the little white; or it is very "high-end ",

For the individual, it is not commonly used or even never used for the whole life. Therefore, based on the various types of online pasters and other resources, I personally tried to install and debug them and organized the following tutorial.

Since then, I have never worried about installing the FTP server with vsftpd In ubuntu! (PS: This is the simplest and best-to-use tutorial; starting point: it is good to use it)


This article tests the Ubuntu server 14.04 amd64 system.


Install FTP

sudo apt-get install vsftpd

Configure vsftpd. conf

sudo nano /etc/vsftpd.conf
# Prohibit anonymous access to anonymous_enable = No # accept the local user local_enable = yes # Allow upload write_enable = yes # the user can only access the restricted directory chroot_local_user = yes # set a fixed directory and add it at the end. If you do not add this line, each user corresponds to his/her own directory. Of course, this folder has its own local_root =/home/ftp

Read the Internet and add a line "pam_service_name = vsftpd". I think this configuration file already exists, and it doesn't matter.

Add an FTP user

sudo useradd -d /home/ftp -M ftpusersudo passwd ftpuser

Adjust folder Permissions

This avoids "500 Oops: vsftpd: refusing to run with writable root inside chroot ()"

sudo chmod a-w /home/ftpsudo mkdir /home/ftp/data

In this way, the data folder will be displayed after login, although a little trouble, the reason is not listed .. It is not easy to query information ..

Modify Pam. d/vsftpd

At this time, log on to the FTP using the useradd account, and the 530 login incorrect

sudo nano /etc/pam.d/vsftpd

Comment out

#auth    required pam_shells.so

Restart vsftpd

sudo service vsftpd restart

Now you can use the ftpuser you just created to log on to FTP. What you can see is/home/FTP set by local_root, which is restricted to this directory.

Can be accessed in the browser with a ftp://xxx.xxx.xxx.xxx, or FTP software such as flashfxp, the password is the ftpuser password.

Restrictions on user access to folders

Controlled by the chroot_local_user, chroot_list_enable, and chroot_list_file files, let's take a line from another person:

First, chroot_list_enable is easy to understand, that is, whether to enable the chroot_list_file configuration file. If yes, it indicates that the chroot_list_file configuration file takes effect; otherwise, it does not take effect;
Second, chroot_list_file is also simple. A file path is configured. The default value is/etc/vsftpd. chroot_list. Some account names are entered in this file. However, the meaning of these accounts is not fixed, and it is related to the configuration item chroot_local_user. Description in the next line;
Third, if the value of chroot_local_user is yes, all users * cannot * switch to a directory other than the main directory,! Except for the users listed in the chroot_list_file configuration file. If the value of chroot_local_user is no, all users can ** switch to a directory other than the home directory,! Except for the users listed in the chroot_list_file configuration file. It can also be understood as the "exceptions" listed by chroot_list_file.

If the system prompts "connection failed in PASV mode" when logging on to the client"

Edit/etc/vsftpd. conf

Last added

pasv_promiscuous=YES

Then restart the vsftpd service.

Sudo service vsftpd restart

Configure the FTP server with vsftpd in Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.