CentOS 7 Installation Configuration FTP server

Source: Internet
Author: User

CentOS7 the installation configuration of the FTP server.

Suppose we have the following requirements

Path Permissions Note
/ftp/open All members of the company, including guests, can access Read-only
/ftp/private Only three people are allowed to visit Alice, Jack, and Tom

Alice and Jack are only allowed to download,

Tom can upload both using a virtual account

Install FTP

Installing with Yum

# Yum-yinstall FTP vsftpd

or use RPM to install the following two packages

Ftp-0.17-66.el7.x86_64

Vsftpd-3.0.2-9.el7.x86_64

Also need to install the DB package, used to encrypt the virtual user's account information

This package is already installed by default in Centos7.

# Rpm-qf/usr/bin/db_load

Libdb-utils-5.3.21-17.el7_0.1.x86_64

Configuration

# Mkdir/ftp/open

Make a few test files

# echo Opentest >/ftp/open/open.txt

# echo Filetest >/tmp/filetest1.txt

# Touch/ftp/open/anontest.txt

View the path to the configuration file

# RPM-QC VSFTPD

/etc/logrotate.d/vsftpd

/etc/pam.d/vsftpd

/etc/vsftpd/ftpusers

/etc/vsftpd/user_list

/etc/vsftpd/vsftpd.conf

# cd/etc/vsftpd/

Back up the original configuration file

# CP vsftpd.conf Vsftpd.conf.origin

Create a password plaintext file

# Vi/etc/vsftpd/vftpuser.txt

Alice

[Email protected]

Jack

[Email protected]

Tom

[Email protected]

Create a password DB file based on clear text

# db_load-t-T hash-f/etc/vsftpd/vftpuser.txt \

/etc/vsftpd/vftpuser.db

View Password data files

# file/etc/vsftpd/vftpuser.db

/etc/vsftpd/vftpuser.db:berkeley db (Hash, version9, native Byte-order)

Create a Guest account for VFTPD

# useradd-d/ftp/private-s/sbin/nologin Vftpuser

# VI/ETC/PAM.D/VSFTPD

Comment out all the configuration line lines for Auth and account, adding the following:

Auth Required pam_userdb.so Db=/etc/vsftpd/vftpuser

Account Required Pam_userdb.sodb=/etc/vsftpd/vftpuser

Open configuration file

# vi/etc/vsftpd/vsftpd.conf

At the end of the add

Anon_root=/ftp/open

Virtual_use_local_privs=yes

Guest_enable=yes

Guest_username=vftpuser

Chroot_local_user=yes

Allow_writeable_chroot=yes

Set up auto-start

# Systemctl Enable VSFTPD

Ln-s '/usr/lib/systemd/system/vsftpd.service '/etc/systemd/system/multi-user.target.wants/vsftpd.service '

# Systemctlstart VSFTPD

View the current status

# Systemctlstatus VSFTPD

VSFTPD.SERVICE-VSFTPD FTP Daemon

Loaded:loaded (/usr/lib/systemd/system/vsftpd.service; enabled)

Active:active (running) since Mon 2014-08-11 19:57:12 CST; 22h ago

Main pid:12733 (VSFTPD)

Cgroup:/system.slice/vsftpd.service

A "a" 12733/usr/sbin/vsftpd/etc/vsftpd/vsftpd.conf

SYSTEMD[1]: Starting Vsftpd FTP daemon ...

SYSTEMD[1]: Started Vsftpd FTP daemon.

VSFTPD[12738]: Pam_userdb (vsftpd:auth): User ' Alice ' granted access

VSFTPD[12753]: Pam_userdb (vsftpd:auth): User ' Jack ' granted access

SYSTEMD[1]: Started Vsftpd FTP daemon.

Test

Test anonymous accounts

# Ftplocalhost

Trying:: 1 ...

Connected to localhost (:: 1).

(VsFTPd 3.0.2)

Name (localhost:root): Anonymous

331 Specify the password.

Password:

Successful Login.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp> ls

229 Entering Extended Passive Mode (| | | 61057|).

Here comes the directory listing.

-rw-r--r--1 0 0 9 11:45 open.txt

226 Directory send OK.

Ftp> lcd/tmp

Local Directory Now/tmp

Ftp> Getopen.txt

Local:open.txt Remote:open.txt

229 Entering Extended Passive Mode (| | | 64276|).

Opening BINARY Mode data connection Foropen.txt (9 bytes).

226 Transfer complete.

9 Bytes received in 0.000895 secs (10.06 kbytes/sec)

Ftp> bye

221 Goodbye.

Test your local account

# Ftplocalhost

Trying:: 1 ...

Connected to localhost (:: 1).

(VsFTPd 3.0.2)

Name (localhost:root): Alice

331 Specify the password.

Password:

Successful Login.

Remote system type is UNIX.

Using binary mode to transfer files.

Ftp> ls

229 Entering Extended Passive Mode (| | | 21750|).

Here comes the directory listing.

226 Directory send OK.

Ftp>!ls/tmp

Filetest1.txt open.txt systemd-private-9xpn7y vmware-fonts0 vmware-installer1 vmware-root vmware-t Ools-distrib

ks-script-_yi85r samba.docx vmware-config0 Vmware-installer0 vmware-installer2 vmware-root-2117481760 yum.log

Ftp> lcd/tmp

Local Directory Now/tmp

Ftp> Putfiletest1.txt

Local:filetest1.txt Remote:filetest1.txt

229 Entering Extended Passive Mode (| | | 65399|).

Ok to send data.

226 Transfer complete.

9 Bytes Sent in 5.9e-05 secs (152.54 kbytes/sec)

Ftp> bye

221 Goodbye.

CentOS 7 Installation Configuration FTP server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.