[Reprint] How to set up FTP service in linux

How to set up FTP service in linux

https://linux.cn/article-6284-1.html

 

Author:  alimiracle  Translator:  LCTT  cvsher 

| 2015-09-24 13:04 Comments:  9  Favorites:  16    

In this tutorial, I will explain how to set up your own FTP service. But first we should learn what FTP is.

What FTP is?

FTP  is File Transfer Protocol File Transfer Protocol acronym. As the name suggests, FTP for file transfer between computers over a network. You can transfer files between computers account via FTP, you can also transfer files, or visit online software archives between accounts and desktop computers. However, it should be noted that most of the FTP site usage is very high, you may need to connect several times to reconnect.

FTP address and HTTP address (ie web address) is very similar, except FTP address using ftp: // prefix instead of http: //

What FTP server?

Typically, the computer has a FTP address is dedicated to receiving FTP connection request. A computer dedicated to receiving the connection request is the FTP server FTP site or FTP.

Now, let's begin a special adventure, we will set up an FTP service for family and friends for file sharing. In this tutorial, we will vsftpd as ftp service.

VSFTPD is a self-proclaimed most secure FTP server software. In fact VSFTPD first two letters of "very safe very secure". Construction of the software bypasses the FTP protocol vulnerabilities.

Nevertheless, you should know that there is a more secure method of file management and transfer, such as: SFTP (using OpenSSH ). FTP protocol is very useful and reliable for sharing non-sensitive data.

Use rpm to install VSFTPD:

You can use the following command in the quick installation VSFTPD command line interface:

  1. dnf -y install vsftpd

Use deb installation VSFTPD:

You can use the following command in the quick installation VSFTPD command line interface:

  1. sudo apt-get install vsftpd

VSFTPD installed in the Arch:

You can use the following command in the quick installation VSFTPD command line interface:

  1. sudo pacman -S vsftpd

Configuring the FTP service

Most VSFTPD configuration items are /etc/vsftpd.conf profile. The file itself has very good documentation, and therefore, in this section, I can only highlight some of the important options you might be modified. Use man page to see all the options available and the basic documentation:

  1. man vsftpd.conf

According to the standard hierarchical file system, FTP to share files by default located in / srv / ftp directory.

Allow to upload:

In order to allow ftp user can modify the contents of the file system, such as uploading files, "write_enable" flag must be set to YES.

  1. write_enable=YES

Allow local (system) user login:

To allow the user file / etc / passwd recorded in the log ftp service, "local_enable" mark must be set to YES.

  1. local_enable=YES

Anonymous user login

The following configuration content control whether to allow anonymous user login:

  1. # 允许匿名用户登录
  2. anonymous_enable=YES
  3. # 匿名登录不需要密码(可选)
  4. no_anon_password=YES
  5. # 匿名登录的最大传输速率,Bytes/second(可选)
  6. anon_max_rate=30000
  7. # 匿名登录的目录(可选)
  8. anon_root=/example/directory/

Root directory limit (Chroot Jail)

(LCTT Annotation: chroot jail is a security mechanism unix-system for modifying processes running root directory environment, limiting the thread can not perceive the presence of other directory structure and file other than the root directory tree See details. Chroot jail )

Sometimes we need to set the root (chroot) environment to prevent users from leaving their home (home) directory. Add / modify disposed below the root directory open limit (Chroot Jail) in the configuration file:

  1. chroot_list_enable=YES
  2. chroot_list_file=/etc/vsftpd.chroot_list

"Chroot_list_file" variable specifies the root file / directory directory restrictions contained in (LCTT translation: users can only access those files / directories)

Finally, you must restart the ftp service, enter the following command at the command line:

  1. sudo systemctl restart vsftpd

So far, your ftp service has been completed and started to build.

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/12088970.html