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

The basic installation and use of PureFtpd under Linux and the solution to the problem of timeout

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

Share

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

This article mainly introduces "the basic installation and use of PureFtpd under Linux and the solution to the timeout problem". In the daily operation, I believe that many people have doubts about the basic installation and use of PureFtpd under Linux and the solution to the timeout problem. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "the basic installation and use of PureFtpd under Linux and the solution to the timeout problem". Next, please follow the editor to study!

Basic installation and use method

First of all, before installation, it is best to use netstat-ntl to check whether the default port 21 of ftp is occupied. At the same time, you can also use the ps-ef instruction to check which services are enabled, and see if there are any services like sftp or vsftp. If it is enabled, use the killall sftp instruction to kill the service.

1. Download pureftp. I downloaded pure-ftpd-1.0.30.

Directive:

The code is as follows:

Wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.30.tar.bz2

two。 Decompress:

The code is as follows:

Tar-xvjf pure-ftpd-1.0.30.tar.bz2

Go to the decompressed directory:

The code is as follows:

Cd pure-ftpd-1.0.30

3. For compilation, it is recommended to use all installations:

The code is as follows:

. / configure-prefix=/usr/local/pure-ftpd/-with-

Language=simplified-chinese-with-everything

4. Installation:

The code is as follows:

Make & & make check & & make install

5. Establish the appropriate installation directory:

The code is as follows:

Mkdir / usr/local/pure-ftpd/etc

6. Copy the configuration file and the main execution file to the corresponding folder:

The code is as follows:

Cp configuration-file/pure-ftpd.conf / usr/local/pure-ftpd/etc/

Cp configuration-file/pure-config.pl / usr/local/pure-ftpd/sbin/

Chmod 755 / usr/local/pure-ftpd/sbin/pure-config.pl

7. Customize the environment variables of the system:

The code is as follows:

Cd / usr/local/bin/

Ln-s / usr/local/pure-ftpd/bin/*.

Ln-s / usr/local/pure-ftpd/sbin/* / usr/local/sbin/

Ln-s / usr/local/pure-ftpd/man/man8/* / usr/local/share/man/man8/

8. Start the pureftp server:

The code is as follows:

Pure-config.pl / usr/local/pure-ftpd/etc/pure-ftpd.conf

The following information is generally displayed on the screen:

Running: / usr/local/pure-ftpd/sbin/pure-ftpd-A-b-B-C20-d-e-fnone-H-I15-L2000RV 8-M-M4-p45000RV 50000-Q1RV 10-s-t200-U133RV 022-u100-r-Oclf:/var/log/pureftpd.log-k99-Z

At this point, you can detect whether the port is open by using the telnet ip address 21 under the command line window.

9.pureftp generally does not need the default root user to operate. It generally creates additional user names and groups, and logs in with virtual users.

Create a group:

The code is as follows:

Groupadd ftpgroup

Create a user:

The code is as follows:

Useradd-g ftpgroup-d / dev/null-s / etc ftpuser

After the creation is completed, you can use cat / etc/passwd and cat / etc/group to check whether the group and user have been created.

10. Add ftp virtual user

The code is as follows:

Ure-pw useradd test-u ftpuser-d / home/ftpusers/test

If you want to delete after adding, you can use the pure-pw userdel test directive.

If you want to change the password, you can use the pure-pw passwd test instruction.

11. View user information

The code is as follows:

Pure-pw show test

twelve。 Generate database files

The code is as follows:

Pure-pw mkdb

13. Be sure to modify the configuration file, because the default installation location of many profile databases is not the actual location, which will result in each login

The password can not be found when Lu, ftp always shows passwd required, so be sure to modify the configuration file after installation, especially the pink one.

Parts, pay attention to modification

Open the configuration file:

The code is as follows:

Vi / usr/local/pure-ftpd/etc/pure-ftpd.conf

ChrootEveryone yes # enable chroot

BrokenClientsCompatibility yes # is compatible with different clients

Daemonize yes # running in the background

MaxClientsPerIP 20 # maximum connections per ip

VerboseLog yes # logging

DisplayDotFiles no # shows hidden files

AnonymousOnly no # only allows anonymous users to access

NoAnonymous yes # does not allow anonymous users to connect

SyslogFacility none # does not display logs in syslog logs

DontResolve yes # does not parse client-side DNS

MaxIdleTime 15 # maximum idle time

LimitRecursion 2000 8 # browsing restrictions, file 2000, directory 8 layer

AnonymousCanCreateDirs no # Anonymous users can create directories

Download of MaxLoad 4 # is prohibited when it exceeds the load.

PassivePortRange 45000 50000 # passive mode port range

# AnonymousRatio 1 10 # Anonymous user upload / download ratio

UserRatio 1 10 # upload / download ratio for all users

AntiWarez yes # prohibits downloading files uploaded by anonymous users but not verified

# AnonymousBandwidth 200 # Anonymous user bandwidth limit (KB)

UserBandwidth 8 # maximum bandwidth for all users (KB)

Umask 133 022 # create file / directory default mask

MinUID 100 # maximum UID limit

AllowUserFXP no # only runs users for FXP transfer

AllowAnonymousFXP no # allows anonymous FXP transfers for anonymous and non-anonymous users

ProhibitDotFilesWrite no # cannot delete / write hidden files

ProhibitDotFilesRead no # forbids reading hidden files

AutoRename yes # automatically rename a file with the same name

AnonymousCantUpload yes # does not allow anonymous users to upload files

AltLog clf:/var/log/pureftpd.log # clf format log file location

PureDB / usr/local/pure-ftpd/etc/pureftpd.pdb # user database file

MaxDiskUsage 99 # disable upload when disk usage reaches 99%

CreateHomeDir yes # automatically created if the virtual user's directory does not exist

CustomerProof yes # prevent misoperation of commands

PureDB / usr/local/pure-ftpd/etc/pureftpd.pdb must remember to modify this place, otherwise it will always be

If you can't log on, you can execute it again after the modification is completed.

14. Regenerate the database file

The code is as follows:

Pure-pw mkdb

15. First, kill the previous pureftp service.

The code is as follows:

Killall pure-ftpd

16. And then restart.

The code is as follows:

/ usr/local/pure-ftpd/sbin/pure-config.pl / usr/local/pure-ftpd/etc/pure-ftpd.conf

17. At this time, you can log in successfully, but you may not be able to upload it to the server. At this time, it is usually a permission problem.

Log in to ftp's home directory

The code is as follows:

Cd / home/ftpusers/test

Modify file permissions under the test folder

The code is as follows:

Chown ftpuser:ftpgroup wenjian1

Try to reconnect and upload later.

Record of solving the problem of connection timeout

problem

Recently, pureftpd was installed on the server and provided to colleagues in the company to upload files. There is no problem with using FileZilla testing before delivery, but colleagues report that ftp cannot be used under Linux.

I tested it under Linux, got stuck in Entering Passive Mode all the time, and finally timed out.

Reason

There is no problem with using FileZilla testing under windows. Taking a closer look at FileZilla's log, I found a line.

Considering that the pureftpd uses a CVM, and the Nic of the CVM is only bound with a private network IP, the public network IP should be bound to routing. Guess that when the ftp client connects to the pureftpd in passive mode, pureftpd returns an intranet IP.

By grabbing the package by wireshark, we found:

You can know that the server did return an intranet address.

Method

Can you force pureftpd to return to the public network IP? By looking at the pureftpd document, I found that adding:

The code is as follows:

ForcePassiveIP 1.1.1.1

1.1.1.1 is pureftpd public network ip. The problem is resolved after reboot.

At this point, the study on "the basic installation and use of PureFtpd under Linux and the solution to the timeout problem" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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