CentOS 7 /RHEL 7: How To Install And Configure FTP Server (vsftpd)

Normally you can download or upload files to FTP Server and you cthe defalut FTP package used is vsftpd,  it is a very secure file transfer protocol under CentOS 7 or RHEL 7 linux system.  How to install vsftpd package on centos 7 system? How do I install and configure FTP server or Vsftp service? in this article, you will see how to install, configure and setup FTP server on CentOS 7 or RHEL 7 linux system.

From wikipedia:

The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files from one host to another host over a TCP-based network, such as the Internet.

​Actually FTP is still not a very secure protocol and still has many security weaknesses., if it is possible, you can setup it with SSL/TLS connection or use SFTP (Secure FTP), it is a more secure protocol and use the Secure shell protocol to transfer files.

From Wikipedia:

The SSH file transfer protocol or secure FTP (SFTP), also transfers files and has a similar command set for users, but is built on different software technology. SFTP uses the Secure Shell protocol (SSH) to transfer files. Unlike FTP, it encrypts both commands and data, preventing passwords and sensitive information from being transmitted openly over the network. It cannot interoperate with FTP software.

CentOS 7 /RHEL 7 Install Vsftpd 

Issue the following yum command to install the vsftpd package to setup ftp server on centos 7 system, type:

yum install vsftpd

Outputs:

[root@osetc Desktop]# yum install vsftpd

Loaded plugins: fastestmirror, langpacks

base                                                     | 3.6 kB     00:00

extras                                                   | 3.4 kB     00:00

updates                                                  | 3.4 kB     00:00

updates/7/x86_64/primary_db                                | 4.8 MB   00:04

Loading mirror speeds from cached hostfile

* base: mirrors.btte.net

* extras: mirrors.btte.net

* updates: mirrors.nwsuaf.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package vsftpd.x86_64 0:3.0.2-9.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package          Arch             Version                 Repository      Size

================================================================================

Installing:

vsftpd           x86_64           3.0.2-9.el7             base           165 k

Transaction Summary

================================================================================

Install  1 Package

Total download size: 165 k

Installed size: 343 k

Is this ok [y/d/N]: y

Downloading packages:

vsftpd-3.0.2-9.el7.x86_64.rpm                              | 165 kB   00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : vsftpd-3.0.2-9.el7.x86_64                                    1/1

Verifying  : vsftpd-3.0.2-9.el7.x86_64                                    1/1

Installed:

vsftpd.x86_64 0:3.0.2-9.el7

Complete!

Before edit the configuration file” vsftpd.conf“, you’d better backup it, type:

cp /etc/vsftpd/vsftpd.conf  /etc/vsftpd/vsftpd.conf.bak

CentOS 7 /RHEL 7 Configure Vsftpd FTP Server 

After installed vsftpd package, now we can start to edit vsftpd configuration file, using “vim” command to edit “/etc/vsftpd/vsftpd.conf” and find the following lines and make the changes as below :

anonymous_enable=NO     #==> line 12:  To disable anonymous access

local_enable=YES                #==>enable local user access

write_enable=YES                #==>enable write permission for ftp user

chroot_local_user=YES        #==> line 100, 101: uncomment ( enable chroot )

chroot_list_enable=YES

ascii_upload_enable=YES    #==>uncomment ( allow ascii mode )ascii_download_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list  #==>uncomment ( specify chroot list )

listen=YES

listen_ipv6=NO

If you want to learn more information about “vsftpd.conf”, you can have a look manual page of “vsftpd.conf”, just type “man vsftpd.conf” command.

Then save above configuration file and restart the vsftpd service using the following command:

sudo systemctl restart vsftpd.service

outputs:

[root@osetc Desktop]# systemctl restart vsftpd.service

[root@osetc Desktop]# systemctl status vsftpd.service

vsftpd.service - Vsftpd ftp daemon

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

Active: active (running) since Fri 2014-12-05 09:08:53 EST; 11s ago

Process: 14095 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)

Main PID: 14096 (vsftpd)

CGroup: /system.slice/vsftpd.service

└─14096 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Dec 05 09:08:53 itsprite systemd[1]: Starting Vsftpd ftp daemon...

Dec 05 09:08:53 itsprite systemd[1]: Started Vsftpd ftp daemon.

Set vsftpd service to start while system startup, type:

sudo systemctl enable vsftpd.service

CentOS 7 /RHEL 7 Add A FTP Users

As disallowing anonymous user to login the ftp server in above configuration so you’d better create a new ftp user, As root user is not allowed to login the ftp server by default. using the following command to create a user and set use password. create a ftp user named “ftpuser”, type:

useradd ftpuser
passwd ftpuser

Outputs:

[root@osetc Desktop]# useradd ftpuser

[root@osetc Desktop]# passwd ftpuser

Changing password for user ftpuser.

New password:

BAD PASSWORD: The password is a palindrome

Retype new password:

passwd: all authentication tokens updated successfully.

CentOS 7 /RHEL 7 Configure Firewall For vsftpd 

If you want to connect to the Vsftp FTP server remotely, you must allow the default FTP port 21 through firewall, type the following command:

firewall-cmd --permanent --add-port=21/tcp

or

firewall-cmd --permanent --zone=public --add-service=ftp

then reload the firewall service, type:

firewall-cmd --reload

CentOS 7 /RHEL 7 Install FTP Client

If you want to login the ftp server, you should install a ftp client , issue the following command:

yum install ftp

Outputs:

[root@osetc Desktop]# yum install ftp

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirrors.btte.net

* extras: mirrors.btte.net

* updates: mirrors.nwsuaf.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package ftp.x86_64 0:0.17-66.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package        Arch              Version                 Repository       Size

================================================================================

Installing:

ftp            x86_64            0.17-66.el7             base             61 k

Transaction Summary

================================================================================

Install  1 Package

Total download size: 61 k

Installed size: 96 k

Is this ok [y/d/N]: y

Downloading packages:

ftp-0.17-66.el7.x86_64.rpm                                 |  61 kB   00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : ftp-0.17-66.el7.x86_64                                       1/1

Verifying  : ftp-0.17-66.el7.x86_64                                       1/1

Installed:

ftp.x86_64 0:0.17-66.el7

Complete!

Or you can use other third part software, such as: filezilla.

CentOS 7 /RHEL 7 Test FTP Server

After installed and configured vsftpd ftp server, the next step is to verify that if the ftp server can work normally.  let’s have a test to login the ftp server using ftp user in command interface line, type:

ftp 127.0.0.1

Output:

[root@osetc Desktop]# ftp 127.0.0.1

Connected to 127.0.0.1 (127.0.0.1).

220 (vsFTPd 3.0.2)

Name (127.0.0.1:root): ftpuser

331 Please specify the password.

Password:

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp>

done……

You might also like:

Sidebar



back to top