Install config and uninstall FTP (GO) in Ubuntu

Source: Internet
Author: User
Tags parent directory file permissions

Reprint: http://zyjustin9.iteye.com/blog/2178943

One. Installation
1. Install the VSFTPD with the Apt-get tool:

Java code
    1. $ sudo apt-get install vsftpd


2. Check if the FTP port is already open

Java code
    1. $ netstat-tnl



or enter "ftp://server IP" directly in the browser.

Commands to turn on, stop, and restart the VSFTPD service:

XML code
    1. Service VSFTPD Start | Stop | Restart


Two. Configuration
1. Modify the configuration file

Java code
    1. $ sudo vi/etc/vsftpd.conf


Main configuration:

XML code
  1. listen=YES # Server monitoring
  2. local_enable=YES # allows local users to access
  3. write_enable=YES # is allowed to upload files, do not open will be reported 550 permission denied
  4. anonymous_enable=No # Anonymous access allowed, default does not open,
  5. #anon_upload_enable=Yes # anonymous upload allowed, default is no
  6. #anon_mkdir_write_enable=YES # Anonymous Create folder allows


Permission settings for the user to access the directory:
In the default configuration, a local user can switch to a different directory using the CD command after logging in to FTP, which poses a security risk to the system. You can control the user to switch directories by using the following three configuration files.

XML code
    1. chroot_local_user=YES To specify whether users in the user list file are allowed to switch to the parent directory.  The default value is No.
    2. chroot_list_enable=YES # Sets whether the user list file specified by the Chroot_list_file configuration item is enabled.  The default value is No.
    3. Chroot_list_file=/etc/vsftpd.chroot_list
    4. #禁用的列表名单, in the form of a single user, that specifies a user list file that controls which users can switch to the parent directory of the user's home directory.


The following effects can be achieved by pairing:

XML code
  1. (1). When chroot_list_enable=Yes,chroot_local_user=Yes, users listed in the/etc/vsftpd.chroot_list file can switch to a different directory  , users who are not listed in the file cannot switch to a different directory.
  2. (2). When chroot_list_enable=YES,chroot_local_user=No, users listed in the/etc/vsftpd.chroot_list file cannot switch to a different directory  , users who are not listed in the file can switch to a different directory.
  3. (3). When chroot_list_enable=No,chroot_local_user=Yes, all users cannot switch to a different directory.
  4. (4). When chroot_list_enable=No,chroot_local_user=No, all users can switch to a different directory.

Additional Configuration explanations:

XML code
  1. local_umask=022 # Local file permissions on FTP, default is 077
  2. dirmessage_enable=YES # Enter folder Allow
  3. xferlog_enable=YES # FTP log records allow
  4. connect_from_port_20=YES # Enable Port 20th as the port for data transfer
  5. xferlog_enable=Yes # activates uploads and down logs
  6. xferlog_std_format=Yes # uses the standard log format
  7. ftpd_banner=XXXXX # Welcome Info


RELATED links:
VSFTPD configuration file Detailed

2. Restart the VSFTPD service

Java code
    1. $sudo/etc/init.d/vsftpd Restart
    2. Or
    3. $ sudo service vsftpd restart

Note: You must restart the service to take effect after modifying the configuration file


Three. FTP Add delete User
1. Add Users
#创建目录

Java code
    1. Mkdir-p/home/test


#创建用户

Java code
    1. sudo useradd-g ftp-d/home/test-m test

(Note: G: The user's Group D: the location to create the user's own directory given m: Do not establish the default home directory, that is, there is no own directory under//)

#设置用户口令

Java code
    1. sudo passwd test123


Edit the/etc/vsftpd.chroot_list file, add the FTP account name, save the exit

Restart VSFTPD:

Java code
    1. $ sudo service vsftpd restart

Note: After you modify the user rights file Vsftpf.chroot_list file, you must restart the service to take effect


2. Delete a user

Java code
    1. $ sudo userdel test


Four. Uninstall

sudo apt-get remove--purge vsftpd

(--purge option means complete removal of software and related files)

Install config and uninstall FTP (GO) in Ubuntu

Related Article

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.