FTP is mainly used for file transfer, and is generally implemented with vsftpd on Linux. By setting up an FTP server, file sharing can be achieved, which is at least much better than the crappy Baidu network disk. There are three optional authentication methods for setting up an FTP server: anonymous authentication, local user authentication, and virtual user authentication. Security: anonymous authentication < local user authentication < virtual user authentication. Configuration complexity: anonymous authentication < local < virtual user authentication. In Linux, all files have corresponding owners. Virtual user authentication means creating one or more FTP users and mapping them to a local Linux user (such as vftpuser). In this way, the mapped user is equivalent to the user vftpuser when operating the FTP directory. In addition, the virtual user authentication mode allows multiple FTPs to be configured separately, which is very flexible and convenient. Considering flexibility and security, this article chooses to use the virtual user authentication mode. OK, ready to get started! 1. Basic Environment Server: CentOS7.5 Client: Ubuntu Mate 18.10 FTP server: vsftpd FTP client: FileZilla (optional) 2. Basic Process To make it look more concise, only the basic setup process and related commands are listed. 1. Install vsftpd yum install vsftpd 2. Create a virtual user Create and edit the /etc/vsftpd/vuser.list file using any editor you like with the following content:
The odd-numbered lines of the password authentication file contain usernames, and the even-numbered lines contain corresponding passwords. 3. Create a password authentication database db_load -T -t hash -f /etc/vsftpd/vuser.list /etc/vsftpd/vuser.db chmod 600 /etc/vsftpd/vuser.db -T: Transform 4. Edit Create and edit auth required pam_userdb.so db=/etc/vsftpd/vuser account required pam_userdb.so db=/etc/vsftpd/vuser db specifies the password authentication database, without the suffix 5. Create a local user useradd -d /home/vftpuser -s /sbin/nologin vftpuser chmod 755 /home/vftpuser -d: Specify the user's home directory 6. Map Edit pam_service_name=vsftpd.vu # Specify the pam authentication file guest_enable=YES # Enable mapping guest_username=vftpuser # Specify the local user for mapping user_config_dir=/etc/vsftpd/vusers_dir # Specify the location of the FTP user configuration file. If you do not need to configure each user separately, you can comment out this line 7. Configure each user individually Create anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_enable=YES local_root=/var/www/html The default root directory is the mapped user's home directory. You can specify a user's root directory through local_root. Note that the owner of this directory needs to be changed to vftpuser. 8. Restart vsftpd systemctl start vsftpd 3. Notes
The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
>>: The implementation process of long pressing to identify QR code in WeChat applet
The following is an introduction to using SQL que...
clear:both is used to清除浮動This is the impression I...
Preface Many web applications store data in a rel...
1. Install a virtual machine (physical machine) Y...
I was curious about how to access the project usi...
vue-router has two modes hash mode History mode 1...
Table of contents Preface 1. Download MySQL 8.0.2...
Table of contents Problem 1: Destruction 1. How t...
Preface When we write code, we occasionally encou...
1. Normal background blur Code: <Style> htm...
Yesterday I wanted to use a:visited to change the...
MySQL5.7.21 installation and password setting tut...
[mysql] replace usage (replace part of the conten...
1. Background During the server development proce...
RGBA is a CSS color that can set color value and ...