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

Deployment and optimization of pureftp,vsftp

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

What is ftp?

FTP is the English abbreviation of File Transfer Protocol (File transfer Protocol), while the Chinese abbreviation is "text transfer Protocol", which is used to control the two-way transfer of files on Internet.

The main function of FTP is to let users connect to a remote computer (where the FTP server program is running) to see what files the remote computer has, and then copy the files from the remote computer to the local computer, or send the files from the local computer to the remote computer.

There is a built-in ftp software on CentOS or RedHat Linux called vsftpd

Install pure-ftpd

1. Download software

Pure-ftpd official website is the latest version of http://www.pureftpd.org/project/pure-ftpd is 1.0.36, but A Ming does not recommend using the latest version, the latest version may have some small bug.

Cd / usr/local/src/

Wget https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.37.tar.bz2

two。 Install pure-ftpd

Tar jxf pure-ftpd-1.0.37.tar.bz2

Cd pure-ftpd-1.0.37

. / configure\

-- prefix=/usr/local/pureftpd\

-- without-inetd\

-- with-altlog\

-- with-puredb\

-- with-throttling\

-- with-peruserlimits\

-- with-tls

Make & & make install

Configure pure-ftpd

1. Modify the configuration file

The compilation and installation of pure-ftpd is completed quickly, and when errors are rare, it's time to configure it:

Cd configuration-file

Mkdir-p / usr/local/pureftpd/etc/

Cp pure-ftpd.conf / usr/local/pureftpd/etc/pure-ftpd.conf

Cp pure-config.pl / usr/local/pureftpd/sbin/pure-config.pl

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

You need to modify the configuration file before starting pure-ftpd. The configuration file is vim / usr/local/pureftpd/etc/pure-ftpd.conf. You can open it and have a look at it. If you are good at English, you can study it carefully. The following is A Ming's configuration file. If you find it troublesome, just copy it:

ChrootEveryone yes

BrokenClientsCompatibility no

MaxClientsNumber 50

Daemonize yes

MaxClientsPerIP 8

VerboseLog no

DisplayDotFiles yes

AnonymousOnly no

NoAnonymous no

SyslogFacility ftp

DontResolve yes

MaxIdleTime 15

PureDB / usr/local/pureftpd/etc/pureftpd.pdb

LimitRecursion 3136 8

AnonymousCanCreateDirs no

MaxLoad 4

AntiWarez yes

Umask 133:022

MinUID 100

AllowUserFXP no

AllowAnonymousFXP no

ProhibitDotFilesWrite no

ProhibitDotFilesRead no

AutoRename no

AnonymousCantUpload no

PIDFile / usr/local/pureftpd/var/run/pure-ftpd.pid

MaxDiskUsage 99

CustomerProof yes

two。 Start pure-ftpd

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

If the startup is successful, a long line of messages starting with Running will be displayed, otherwise it will be an error message. If you can't solve it, please go to Amin Forum (http://www.aminglinux.com/bbs/forum-40-1.html)) for help.

3. Set up an account

[root@localhost] # mkdir-p / data/www/

[root@localhost ~] # useradd www

[root@localhost] # chown-R www:www / data/www/

[root@localhost] # / usr/local/pureftpd/bin/pure-pw useradd ftp_user1-uwww-d / data/www/

Password:

Enter it again:

Among them,-u associates the virtual user ftp_user1 with the system user www, that is, after logging in to ftp using the ftp_user1 account, it will read or download the file as www. The directory after-d is the home directory of the ftp_user1 account, so that ftp_user1 can only access its home directory / data/www/. This is not done yet, and the most critical step is to create a user information database file:

[root@localhost ~] # / usr/local/pureftpd/bin/pure-pw mkdb

Pure-pw can also list the current ftp account, of course, you can delete an account, and we can create another account:

[root@localhost] # / usr/local/pureftpd/bin/pure-pw useradd ftp_user2-uwww-d / tmp

[root@localhost ~] # / usr/local/pureftpd/bin/pure-pw mkdb

List the current account:

[root@localhost ~] # / usr/local/pureftpd/bin/pure-pw list

The command to delete the account is:

[root@localhost ~] # / usr/local/pureftpd/bin/pure-pw userdel ftp_user2

Test pure-ftpd

The tool you need to test is called lftp, so install it first:

[root@localhost ~] # yum install-y lftp

Test:

[root@localhost ~] # touch / data/www/123.txt

[root@localhost ~] # lftp ftp_user1@127.0.0.1

Password:

Lftp ftp_user1@127.0.0.1:~ > ls

Drwxr-xr-x 2 514 www 4096 Jun 12 11:14.

Drwxr-xr-x 2 514 www 4096 Jun 12 11:14..

-rw-r--r-- 1 514 www 0 Jun 12 11:14 123.txt

After logging in, use the ls command to list what files are in the current directory.

In the test, after the successful login, after entering the command, prompt the login error.

Solution:

The login password is too simple. Change it again.

Vsftp configure ftp service

1)。 Yum-y install vsftpd db4-utils

2)。 Set up a system account

Useradd virftp-s / sbin/nologin

3)。 Set up a virtual account

Vim / etc/vsftpd/vsftpd_login

Test

Anxxf0814

4)。 Change permissions

Chmod 600 / etc/vsftpd/vsftpd_login

5)。 Generate library file password

Db_load-T-t hash-f / etc/vsftpd/vsftpd_login / etc/vsftpd/vsftpd_login.db

6)。 Mkdir / etc/vsftpd/vsftpd_user_conf

Cd / etc/vsftpd/vsftpd_user_conf

7)。 Create a profile corresponding to the user

Vim test

Local_root=/home/virftp/test

Anonymous_enable=NO

Write_enable=YES

Local_umask=022

Anon_upload_enable=NO

Anon_mkdir_write_enable=NO

Idle_session_timeout=600

Data_connection_timeout=120

Max_clients=10

Max_per_ip=5

Local_max_rate=50000

8)。 Mkdir / home/virftp/test

Chown-R virftp:virftp / home/virftp

9)。 Vim / etc/pam.d/vsftpd (add two lines)

Auth sufficient / lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

Account sufficient / lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

Note: 64-bit systems need to be written as / lib64/

10)。 Modify the global configuration file vim / etc/vsftpd/vsftpd.conf

Anonymous_enable=NO

Anon_upload_enable=NO

Anon_mkdir_write_enable=NO

Add:

Chroot_local_user=YES (may already exist)

Guest_enable=YES

Guest_username=virftp

Virtual_use_local_privs=YES

User_config_dir=/etc/vsftpd/vsftpd_user_conf

11)。 Start the vsftpd service

/ etc/init.d/vsftpd start

If the startup is not successful, killall-9 pure-ftpd

Test:

Client yum install-y lftp

Lftp test@ server ip

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

Network Security

Wechat

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

12
Report