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 with CentOS7

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces CentOS7 how to build FTP server related knowledge, content detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that everyone will read this CentOS7 how to build FTP server article will have some gains, let's take a look at it.

I. Basic environment

Server: centos 7.5

Client: ubuntu mate18.10

ftp server: vsftpd

ftp client: filezilla (optional)

II. Basic Flow

For simplicity, only the basic setup flow and related commands are listed.

1. Install vsftpd

yum install vsftpd

2. Create virtual users

Create and edit the/etc/vsftpd/vuser.list file with any editor you like, which reads as follows:

lilei

lileipasswd

hanmeimei

hmmpasswd

password authentication file odd rows are user names, even rows correspond to passwords

3. Create 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 hash algorithm

-f: Specify username

4. Edit pam authentication file

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 suffixes

5. Establish local users

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

-d: Specify user home directory

-s: Specify user login shell,/sbin/nologin means to prohibit users from logging in through shell, improve security

6. Map ftp user to vftpuser

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

pam_service_name=vsftpd.vu #Specify pam authentication file guest_enable=yes #Enable mapping guest_username=vftpuser #Specify mapped local user user_config_dir=/etc/vsftpd/vusers_dir #Specify ftp user profile location, comment out this line if you don't need to configure each user individually

7, for each user to configure separately

Create/etc/vsftpd/vuser_dir to create a configuration file with the same name for each ftp user, in this case lilei. 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 by local_root. Note that the owner of this directory needs to be changed to vftpuser.

8. Restart vsftpd

systemctl start vsftpd

III. Precautions

Add vsftpd to boot to prevent the server from being inaccessible after restart;

If ftp server is inaccessible, check firewall and selinux settings;

After the password authentication database is generated, the list file is deleted in time to prevent password disclosure.

About "CentOS7 how to build FTP server" The content of this article is introduced here, thank you for reading! I believe everyone has a certain understanding of the knowledge of "How to build FTP server in CentOS7". If you still want to learn more knowledge, please pay attention to the industry information channel.

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

Development

Wechat

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

12
Report