Tutorial on setting up an FTP server in Ubuntu

Source: Internet
Author: User

UbuntuIs a Linux operating system based on desktop applications,UbuntuAfter implementing the virtual host setting for Multiple Apache users, these users generally choose to use ftp to upload their web content, which requires us to set up FTP services for them.

The FTP server that comes with Ubuntu is vsftpd.

1. Install vsftpd

It is not difficult to install software in Ubuntu. Enter:

 
 
  1. sudo apt-get install vsftpd 

If the source is not changed, you may be prompted to use the disc. Just press Enter.

I use the cn99 source. The speed is KB per second. It is fast enough.

After installation, an FTP directory is created under/home. At this time, you can try to access the ftp: // ip address. You can see an FTP space with blank content.

By default, anonymous users can download files, but cannot write or upload files.

2. Set the vsftpd. conf file

Now, we need to make anonymous users inaccessible and enter the user password on Linux before they can access the contents in their own directories.

First, find the file for setting vsftpd, which is located in/etc/vsftpd. conf.

Back up this file before modification:

 
 
  1. sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.old 

Then you can change the settings:

# Do not allow anonymous users to use

 
 
  1. #anonymous_enable=YES 

# Available local users

 
 
  1. local_enable=YES 

# Available write operations

 
 
  1. write_enable=YES 

# File information in a directory is not required

 
 
  1. #dirmessage_enable=YES 

# Add a banner prompt

 
 
  1. ftpd_banner=Hello~~ 

# Maximum number of users on the FTP server

 
 
  1. max_clients=100 

# Restrict processes of each IP Address

 
 
  1. max_per_ip=5 

# Maximum transmission rate (B/S)

 
 
  1. local_max_rate=256000 

# Hiding accounts

 
 
  1. hide_ids=YES 

Okay. Restart the FTP server to check the effect.

Is it the same after restart as before? Haha, This is the default FTP directory. Let's delete it and check again. How is it? Enter the user name and password.

New Problems

1. After Entering the user name and password, the user's root directory is displayed, and our web content is in the public_html directory.

2. You can jump to any other directory.

InUbuntuTo solve these problems, we have to set vsftpd. conf

# Start the chroot list (Change root)

 
 
  1. chroot_list_enable=YES 

# Specify the location of the List (I use the default address)

 
 
  1. chroot_list_file=/etc/vsftpd.chroot_list 

Next, we need to write it in vsftpd. chroot_list. We want to restrict users so that they will not "drift "......

Currently, linyupark is a user, so you only need to write sudo nano to it.

In this way, we have solved 2nd problems. login users can only activity in their user folders. Below we want to be more aggressive, so that they can only activity in public_html.

Still find vsftpd. conf

# This statement is not set by default. Add it by yourself.

User_config_dir =/etc/define a folder address for individual users.

Create a folder Based on the address you set, and then create a file with the same username as the folder. Nano:

# Root address of the local user. Assume that the user is linyupark.

 
 
  1. local_root=/home/linyupark/public_html 

Restart the server.

Summary:

UbuntuAfter the tutorial on creating an FTP serverUbuntuIt is helpful for you to learn the content of an FTP server!

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.