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 deploy a FTP server in CentOS8

2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is to share with you the detailed tutorial of deploying FTP server in CentOS8. I believe most people don't know how to deploy it yet. In order to let you learn, I summarize the following contents.

1 Overview

CentOS8 uses vsftpd to build a FTP server, and then performs simple anonymous upload / download and user upload / download tests, as well as wget tests.

2 install vsftpdyum install-y vsftpd3 startup service service httpd start4 settings boot boot

Can be used

Systemctl list-unit-files | grep vsftpd

Check to see if the boot starts. Display disabled.

Pass through

Chkconfig vsftpd on

Turn on self-boot, execute systemctl again, and you can see that it becomes enabled.

5 modify / etc/vsftpd/vsftpd.confsudo vim / etc/vsftpd/vsftpd.conf

First modify

For YES.

Add another line of anon_upload_enable=YES

The first line means to allow anonymous login and the second line means to allow anonymous upload.

Restart the service.

Service vsftpd restart6 creates the test file cd / var/ftp/pubsudo vim test

7 Test 7.1 browser Test 7.1.1 Anonymous Test

Ifconfig gets the private network ip, and enter ftp://ip. in the browser

You can see that there is a pub folder with the test file you just created.

Right-click to save and download the file.

Download completed.

Go to the terminal and have a look.

7.1.2 user login test

Input

Ftp://username@ip

Then enter the user password.

The default access is the file in the user's root directory, which is shown here.

Download the same as above, right-click to select.

7.2 ftp Command Test

Install ftp first:

Sudo yum install ftp7.2.1 Anonymous Test ftp ip

Here the user name is ftp, and the password is empty, which means anonymous login. Ftp is the default anonymous login user name. As for the password, you can set one in / etc/vsftpd/vsftpd.conf

No_anon_password=YES

In this way, anonymous users can log in without a password.

7.2.1.1 upload Test

Use the put command directly, followed by the file. The upload.txt here is the upload.txt in the folder where the ftp was executed.

The hint here is that the file cannot be created because of the permission. Make sure / var/ftp/pub has write permission to the "other" user.

The default permission for / var/ftp/pub is 644, which is changed to 647.

Sudo chmod 647 / var/ftp/pub

At the same time, modify the permission to upload files to allow other users to read.

Sudo chmod 644 / root/upload.txt

If not, use the selinux setting.

Getsebool-a | grep ftp

Turn on ftpd_full_access:

Setsebool ftpd_full_access on

Enter the folder where upload.txt is located, execute ftp, and put again.

Success!

7.2.1.2 download Test

Direct get file can, because the above has been set permissions, so there will be no problem.

If there is a problem of authority, we can start from three aspects:

(1) / var/ftp/pub 's readable rights to other users: because it is downloaded and anonymous, only other users' readable rights are needed. (2) the downloaded file's readable permissions to other users. (3) selinux. Set ftpd_full_access to on7.2.2 user login test.

Log in with the corresponding user name and password when executing ftp.

Enter the user root directory by default.

7.2.2.1 upload Test

Just put directly.

If there is a permission problem, refer to the three methods mentioned above in 7.2.1.2.

7.2.2.2 download Test

Feel free to create a new file in the user's root directory, here is kr.

Just get directly.

7.3 wget test

Wget is used to download files. The initial download directory is the same as that of ftp login. For example, if you log in to ftp anonymously and log in to the / var/ftp directory, wget will download the file from this / var/ftp directory to the directory where the wget command is executed. If you log in to ftp with the user "kr", you will log in to the / home/kr directory and wget will download the file from / home/kr.

7.3.1 Anonymous Test

Note, make sure that the downloaded file has readable access to the other user.

Sudo chmod Odysw xxxxxx

Then use wget

Wget ftp://ip/pub/xxxx

7.3.2 user login test

Use-- ftp-user,--ftp-password to specify the user name and password, and the rest are the same as above.

Wget ftp://ip/xxx-ftp-user=xxxx-ftp-password=xxxx

These are the steps for deploying a FTP server in CentOS8, and you need to use it yourself in order to understand the details. If you want to know more about it, welcome to follow 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

Servers

Wechat

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

12
Report