Install FTP under ubuntu16.04

Source: Internet
Author: User
Tags anonymous ftp ftp connection parent directory
install FTP under ubuntu16.04 First, vsftpd 1. Installation
sudo apt-get install vsftpd

The system automatically starts VSFTPD service after installation is complete 2. Run start ftpd service

sudo service vsftpd start
Stop FTPD Service
sudo service vsftpd stop
Restart ftpd Service
sudo service vsftpd restart
See if Port 21st is open
sudo netstat-npltu | grep
TCP    0   0 0.0.0.0:21     0.0.0.0:*     LISTEN      13072/vsftpd  
View current ftpd run status
sudo service vsftpd status
Second,/etc/vsftpd.conf related configuration 1. Basic Configuration Items
# When set to YES, VSFTPD starts as standalone run, xinetd start # When set to No (xinetd is the management daemon, centrally managed services, can reduce the resource consumption of a large number of services) Listen=yes # ibid. If support IPv6 network is valid  Listen_ipv6=no # Support for anonymous user access Anonymous_enable=no # Whether local user access is supported Local_enable=yes # whether to open local user write permission, that is, to allow uploading Write_enable=yes # Permission mask for local users to upload a file local_umask=022 # whether anonymous users are allowed to upload files #anon_upload_enable =yes # Allow anonymous users to create directories #anon_mkdir_write_enable =yes # user into Whether to display Message_file specified file contents (need to add message_file configuration items) when entering the directory #dirmessage_enable =yes # force FTP data transfer using port 20, default YES Connect_from_port_

20=yes # information displayed after login (Welcome message) Ftpd_banner=horizon FTP. # for Yes, all users are prevented from accessing the parent directory and can only access their home directory Chroot_local_user=yes # If all users are prevented from accessing the parent directory, or Chroot_local_user=yes, the item needs to be configured to YES # If the item is not configured, The FTP root permission is not writable, otherwise login times: Oops error # vsftp2.3.5 later version, the configuration item needs to be added manually Allow_writeable_chroot=yes # and the same name as the previous configuration Chroot_local_ User=yes # setting Chroot_list_file is valid Chroot_list_enable=yes # when Chroot_list_enable=yes, the file takes effect, the file needs to be manually added, the user list is stored # If all users are restricted to access to the home directory, still access to the parent directory (that is, Chroot_local_user=yes) # Then the user within the file is a privileged user, can not be restricted access to the directory on the home directory # Conversely, if all users are not restricted, can access the parent directory, IE (chroot_local_user=nO) # Then the user within the file is limited to the user, can only access the respective home directory, prohibit access to the parent directory Chroot_list_file=/etc/vsftpd.chroot_list # set VSFTPD use UTF8 encoded file system utf8_ Filesystem=yes

Listed above are only some of the configuration items, the configuration items that are not listed remain the default 2. Related Documents

/etc/ftpusers File
Users in this file are prohibited from FTP connection, the default list includes root, daemon, nobody and so on. You need to disable a user and add the user name.

userlist_file File
This file needs to be created and specified manually, generally set to/etc/vsftpd.user_list, and is related to the following three configuration items:

# whether to make the Userlist_file configuration file effective
userlist_enable=yes

# When set to YES, Userlist_file users within the specified file are forbidden to connect, similar to Ftpusers
# When set to No, only allow Userlist_file to specify the user connection within the file, restrict all other users
userlist_deny=yes

# file name and path can be freely specified
userlist_file=/etc/ Vsftpd.user_list

# New VSFTPD profile default does not have these three configuration items, to manually add, personally think that generally do not need to add
# need to limit the connection to use the/etc/ftpusers file can be
chroot_list File
The file needs to be created and specified manually, the file name and path can be freely specified, the relevant configuration items have Chroot_local_user, chroot_list_enable and chroot_list_file, specific configuration related reference above configuration file comment description. three, operation mode and access control 1. Operating mode Stand alone
Stand alone refers to running vsftpd, occupying resources, providing FTP services, which is the default way to run
sudo service vsftpd start
Super Daemon
Super Daemon refers to the need to start the VSFTPD service when needed by xinetd.
Need to modify vsftpd.conf configuration file
    Listen=no

If you do not change to No, the following error will occur

Oops:could not bind listening IPv4 socket

Installing XINETD

sudo apt-get install xinetd
sudo vi/etc/xinetd.conf
service ftp
{
        socket_type             = Stream
        Wait                    = no
        user                    = root
        Server                  =/usr/sbin/vsftpd
        log_on_success          + = DURATION USERID
        log_on_failure          + = USERID nice                    = Ten
        Disable                 = no
}

Stop vsftpd, start xinetd

sudo service vsftpd stop
sudo service xinetd start

View ports

$ sudo netstat-npltu | grep
TCP     0      0 0.0.0.0:21     0.0.0.0:*      LISTEN      16787/xinetd  
2. Access Control

Suggested reference: Vsftpd-ubuntu Chinese
Part 10th, 11 and access control related

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.