Article Title: Use vsftpd in Ubuntu to build an FTP server. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The company needs to configure the FTP service on a new server when the front-end time is migrated. This server is installed with the Ubuntu system, and the FTP requirements are not high. Therefore, vsftpd becomes the first choice.
To install vsftpd in Ubuntu, run the following command:
# Apt-get install vsftpd
Next we need to perform simple configuration. First we need to edit its configuration file/etc/vsftpd. conf:
# Vim/etc/vsftpd. conf
A lot of content in this configuration file can be kept by default, but for further understanding, let's take a look at common options!
Listen = YES: Indicates whether to listen to the port. We just need to set up an FTP server. Of course, YES!
Anonymous_enable = NO: Indicates whether anonymous users are enabled. Generally, our servers certainly do not allow anonymous logon. This is so dangerous! So NO is maintained here. Of course, if you need to start anonymous users, do not forget to change it to YES here.
Local_enable = YES: Indicates whether local users are allowed to log on. Of course, we need to log on to the local users because they all have user names and passwords. In this way, you do not need to add an additional FTP account. simply create a Linux User.
Write_enable = YES: whether to allow data writing. If YES, you can upload, modify, and delete files. Otherwise, you can only view and download files, however, modification, deletion, and upload operations are not allowed.
Local_umask = 077: This is the File Permission after the file is uploaded. The default value is 077. Unless otherwise required, we recommend that you keep it unchanged.
Anon_upload_enable = YES: whether the upload permission of anonymous users is enabled. Enable this option if you want anonymous users to upload files as well.
Anon_mkdir_write_enable = YES: it also gives anonymous users the permission to create directories, write, modify, and delete files. Generally, anonymous users cannot use such permissions, which may lead to potential risks.
Dirmessage_enable = YES: whether to display a message prompt after the user enters a directory. YES by default.
Use_localtime = YES: whether to use the local time of the server. Keep the default value "YES.
Xferlog_enable = YES: whether to record FTP user operation records. To facilitate tracing and security, we recommend YES.
Connect_from_port_20 = YES: whether to allow connection from Port 20. Keep YES unless you are sure you do not need this port 20.
Chown_uploads = YES: whether to change the ownership of the uploaded file. By default, the comment does not take effect. If you need to change the permission of the uploaded file to an account, you can select YES to enable it.
Chown_username = whoever: This option is used to take over the previous option and is changed to the permission of the user. Note: Changing to root user permissions is not recommended!
Xferlog_file =/var/log/vsftpd. log: the name of the log file. Keep the default value.
Idle_session_timeout = 600: the number of idle times to automatically disconnect FTP connections. The unit is seconds. The default value is 600 seconds, that is, 10 minutes.
Data_connection_timeout = 120: the timeout time for data transmission. The unit is second. It refers to the time when the data cannot be received during data transmission, and the connection is deemed to have timed out and then disconnected.
Ftpd_banner = Welcome to blah FTP service. This is the Welcome message provided by the server when connecting to FTP.
Chroot_local_user = YES: This option is very important. It determines whether the logged-on FTP user can "Roam" to a directory other than his directory. Unless necessary, it is strongly recommended to set it to YES, lock users in their own directories to prevent them from seeing or modifying system files.
After the above configurations are complete, vsftpd can work properly. Enter the following command to make the settings take effect:
#/Etc/init. d/vsftpd restart
To create a new FTP user, you only need to use the Linux adduser.