Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build FTP Server in CentOS7

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to build a FTP server in CentOS7. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

I. basic environment

Server: CentOS7.5

Client: Ubuntu Mate18.10

FTP server: vsftpd

FTP client: FileZilla (optional)

II. Basic process

In order to look more concise, only the basic 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 with any editor you like, as follows:

Lilei

Lileipasswd

Hanmeimei

Hmmpasswd

Password authentication file odd behavior username, password corresponding to even behavior

3. Create a password authentication database

Db_load-T-t hash-f / etc/vsftpd/vuser.list / etc/vsftpd/vuser.dbchmod 600 / etc/vsftpd/vuser.db

-T: conversion

-t: specify the hash algorithm

-f: specify the user name

4. Edit PAM certification documents

Create and edit / etc/pam.d/vsftpd.vu as follows:

Auth required pam_userdb.so db=/etc/vsftpd/vuseraccount required pam_userdb.so db=/etc/vsftpd/vuser

Db specifies the password authentication database without suffix

5. Establish local users

Useradd-d / home/vftpuser-s / sbin/nologin vftpuserchmod 755 / home/vftpuser

-d: specify the user home directory

-s: specifying users to log in to shell,/sbin/nologin means that users are prohibited from logging in through shell, thus improving security

6. Map FTP users to vftpuser

Edit / etc/vsftpd/vsftpd.conf and modify the following lines:

Pam_service_name=vsftpd.vu # specify pam authentication file guest_enable=YES # enable mapping guest_username=vftpuser # specify the mapping of local users user_config_dir=/etc/vsftpd/vusers_dir # specify the location of the FTP user profile, if you do not need to configure each user separately, comment out this line

7. Configure separately for each user

Create / etc/vsftpd/vuser_dir and create a profile with the same name for each FTP user, taking lilei as an example. Create and edit / etc/vsftpd/vuser_dir/lilei as follows:

Anon_upload_enable=YESanon_mkdir_write_enable=YESanon_other_write_enable=YESlocal_root=/var/www/html

The default root directory is the home directory of the mapped user. You can specify the root directory of a user through local_root. Note that the owner of this directory needs to be changed to vftpuser.

8. Restart vsftpd

Systemctl start vsftpd

Matters needing attention

Add vsftpd to boot to prevent the server from being inaccessible after reboot

If the FTP server is unreachable, check the firewall and SElinux settings

After generating the password authentication database, delete the list file in time to prevent the password from leaking.

After reading the above, do you have any further understanding of how to build a FTP server in CentOS7? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report