vsFTPd server beginner's guide

  • 2020-05-09 19:41:46
  • OfStack

vsftpd is one of the most popular FTP server applications in the Linux distribution. It is very useful and I have been using it for a long time.

1. vsFTPd, currently commonly used FTP server suite;

vsFTPd is one of the most popular FTP server programs in the Linux distribution. Small and light, safe and easy to use; Can let its own characteristics to develop and grasp, but also the most important is to be able to use;

Currently, FTPD suites commonly used in open source operating systems mainly include ProFTPD, PureFTPd and wuftpd, etc. As for which FTP server suite is better, which one you are most familiar with, which one is the best;

2. ftp user management commentary;

FTP server for managing the user by default is based on/etc/passwd and/etc group, so we need to know 1 Linux system user and user group management, the management of the users and groups is the basis of 1 cutting applications, some of the brothers don't want to know something, just want to 1 step into a good variety of servers, proved this method of learning is the most unwise; Although you may have started the ftp server in a few minutes, you will always know what went wrong when you encounter a problem. So the fundamentals are extremely important;

Recommended article: management overview of Linux users (user) and user groups (group)

2.1 understanding of anonymous ftp users and user groups;

When we visit the major FTP sites, we may not think about who we are logging in, if his FTP allows anonymous logging. Like when we type in the browser;

ftp://mirrors.kernel.org

or

ftp://ftp:ftp@mirrors.kernel.org

We will find that the two lines above the final can access, but also shows the results of the 1 sample completely, eventually to ftp: / / mirrors kernel. org address; So when we access this FTP, do we have a user and a password? Yes, it is also necessary, but anonymous access is allowed on the server side, and the user name and password for anonymous access are ftp, but we do not feel that it has a user name and password because of anonymous access. The second address is to ftp user, the password is also ftp to access ftp: / / mirrors kernel. org;

If we connect mirrors.kernel.org with the ftp command, we will find that we need to enter the user ftp and password ftp to access it.

In the FTP server, the username and password of the anonymous user are ftp; This user can be found in your operating system /etc/passwd; It might have something like the following 1 row;

ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin

Description:

/etc/passwd is the configuration file of the system user; /etc/group is the system user group configuration file, you can understand some basic knowledge of user management through "Linux user (user) and user group (group) management overview" and related documents;

In the ftp user line, we see seven fields, each of which is separated by:;

ftp is the user name

x is the password field and is hidden;

14 is the user's UID field, which can be set by yourself. It should not be the same as other users' UID, otherwise it will cause system security problems.

50 use GID of user group, you can set it by yourself, do not share FTP of GID with other user groups, otherwise it will cause the whole system problems;

FTP User is the user description field;

/var/ftp is the home directory of ftp users, which can be defined by ourselves.

/sbin/nologin this is the user login SHELL, this can also be defined, /sbin/nologin means can not log in the system; System virtual account (also known as fake user)1 is generally set like this. For example, we change ftp user's /sbin/nologin to /bin/bash, so that ftp user can log into the system as a real user through local or remote tools, ssh or telnet. It's not safe for the system to do that; If you do not think it is necessary for a user to log in to the system, you can only give him the permission of FTP account, that is to say, only give him the permission of FTP, instead of setting his SHELL to /bin/bash, etc.

About the ftp user group:

When we look at /etc/group, we find something like this;

ftp:x:50:

/etc/group is the administrative profile of the user group. The line above represents the user group ftp, x is the password segment, and 50 is GID. We know that ftp users belong to the ftp user group by referring to the ftp line in /etc/passwd, because GID in the ftp user line is the same as GID in the ftp user group;

2.2 can anonymous ftp users and ftp user groups be deleted

In general, it is not possible to delete the rows of ftp users and user groups in /etc/passwd and /etc/group, because the FTP server requires them to manage the FTP users by default.

Although it cannot be deleted, some relevant things can be modified for ftp users in /etc/passwd and /etc/group and 1 of ftp user group. For example, we can change the home directory of ftp users, or change the UID of ftp users... . The premise is that you have some understanding of user management, system user management is the basis of the first application, may be beginners Linux brothers do not understand the importance of user management, but slowly you will find this truth;

3. Installation of vsFTPd;

The vsFTPd software package is available in the installation disk of the latest major distribution. You can install it with the package management tool provided by the corresponding distribution. Of course, you can find the vsftpd packages in the FTP images of major distributions; Of course, you can also install it online with the management tools of the software package. The software package of vsftpd was originally not big, so it didn't take long. Two minutes is enough. Because this is a beginner's tutorial, I strongly recommend that you use the software provided with the distribution to install, not to compile your own source code package installation;

If you are using an Fedora or Redhat system, you can install it online with the following command.

[root@localhost ~]# yum install vsftpd

If it is an debian system, you can use apt to install it online.

[root@localhost ~]# apt-get install vsftpd

If you are an RPM system, you can also find the vsftpd-xxxx.rpm package to install through the rpm command;

[root@localhost ~]# rpm -ivh vsftpd*.rpm

You can download the source package to install

For example, we downloaded vsftpd-2.0.3.tar.gz;

[root@localhost ~]# tar zxvf vsftpd-2.0.3.tar.gz

[root@localhost ~]# cd vsftpd-2.0.3

[root@localhost ~]# make ;make install

[root@localhost ~]# cp vsftpd.conf /etc

Then modify /etc/ vsftpd.conf by adding the following line to the last line of the configuration file;

listen=yes

Source package installation method, if your system is RPM package management system, you can delete/etc/xinetd d/vsftpd this file; Then start the xinetd server;

[root@localhost ~]# /etc/init.d/xinetd restart

Stop xinetd: [ok]

Start xinetd: [ok]

There are two modes of vsFTPd operation. In the system of RPM package management, most of them are developed by Fedora/Redhat. For such systems, there are xinted server 1. For systems that are not RPM package managed, 1 generally does not have xinted as this 1 says. In order to ensure the consistency of this document, we do not use xinetd mode, but initd running mode to start and manage the server, that is, independent running mode; As for what xinted and inted modes are, you can refer to "installing server with vsFTPd self-shelving Linux network".

Through the introduction above, I believe that those beginners know the basic knowledge of vsFTPd, I hope to help you!


Related articles: