How to install, configure and access FTP server via filezilla in Centos

How to install and configure FTP and access FTP server via filezilla on Centos 7

vsftpd (Very Secure File Transport Protocol Daemon) is a secure, fast FTP server. The procedures to install, configure FTP and access FTP server via filezilla on CentOS 7 is explained in this article.


To Install vsftpd

Run the following command to install vsftpd package.

[root@linuxhelp ~]# yum install ftp vsftpd -y
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: centos.webwerks.com
 * extras: centos.webwerks.com
 * updates: centos.webwerks.com
Resolving Dependencies
-->  Running transaction check
--->  Package ftp.x86_64 0:0.17-66.el7 will be installed
--->  Package vsftpd.x86_64 0:3.0.2-11.el7_2 will be installed
-->  Finished Dependency Resolution

Dependencies Resolved
.
.
Installed:
  ftp.x86_64 0:0.17-66.el7                     vsftpd.x86_64 0:3.0.2-11.el7_2                    

Complete!

Open the vsftpd.conf file.

[root@linuxhelp ~]# vim /etc/vsftpd/vsftpd.conf

And edit it as follows.

## Disable anonymous login ##
anonymous_enable=NO
## Uncomment ##
ascii_upload_enable=YES
ascii_download_enable=YES
## Uncomment - Enter your Welcome message - This is optional ##
ftpd_banner=Welcome to UNIXMEN FTP service.
## Add at the end of this  file ##
use_localtime=YES

Save and exit the file.
Then enable and start the vsftpd service.

[root@linuxhelp ~]# systemctl enable vsftpd
ln -s ' /usr/lib/systemd/system/vsftpd.service'  ' /etc/systemd/system/multi-user.target.wants/vsftpd.service' 
[root@linuxhelp ~]#
[root@linuxhelp ~]# systemctl start vsftpd

Allow the ftp service and port 21 via firewall.

[root@linuxhelp ~]# firewall-cmd --permanent --add-port=21/tcp
success
[root@linuxhelp ~]# firewall-cmd --permanent --add-service=ftp
success
[root@linuxhelp ~]#
Restart firewall:
[root@linuxhelp ~]# firewall-cmd --reload
success
[root@linuxhelp ~]#

Then, update the SELinux boolean values for FTP service as shown below.

[root@linuxhelp ~]# setsebool -P ftp_home_dir on
[root@linuxhelp ~]#

To Create FTP users

Root user is not allowed to login into ftp server for security purpose. So, create a normal testing user.

[root@linuxhelp ~]# useradd abc
[root@linuxhelp ~]# passwd abc
Changing password for user abc.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

Connect to FTP server

Connect to FTP server with the user “ abc” .

[root@linuxhelp ~]# ftp 192.168.7.224
Connected to 192.168.7.224 (192.168.7.224).
220 Welcome to linuxhelp FTP service.
Name (192.168.7.224:root): abc
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 
ftp>  exit
221 Goodbye.

Enter the ftp user name and password.

[root@linuxhelp ~]# su - abc
[abc@linuxhelp ~]$
[abc@linuxhelp ~]$ ftp 192.168.7.224
Connected to 192.168.7.224 (192.168.7.224).
220 Welcome to linuxhelp FTP service.
Name (192.168.7.224:abc): abc
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 
ftp>  exit
221 Goodbye.
[abc@linuxhelp ~]$ logout

Access FTP Server Via FileZilla

Install a graphical FTP client called Filezilla to access FTP server.

First, enter the following commands to disable firewalld, and to enable iptables for easy access of filezilla.
Make sure that you execute these commands on your FTP server and not in ftp clients.

[root@linuxhelp ~]# yum install iptables-services
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.webwerks.com
 * extras: centos.webwerks.com
 * updates: centos.webwerks.com
Resolving Dependencies
-->  Running transaction check
--->  Package iptables-services.x86_64 0:1.4.21-13.el7 will be updated
--->  Package iptables-services.x86_64 0:1.4.21-16.el7 will be an update
-->  Processing Dependency: iptables = 1.4.21-16.el7 for package: iptables-services-1.4.21-16.el7.x86_64
-->  Running transaction check
--->  Package iptables.x86_64 0:1.4.21-13.el7 will be updated
--->  Package iptables.x86_64 0:1.4.21-16.el7 will be an update
-->  Finished Dependency Resolution

Dependencies Resolved
.
.
Updated:
  iptables-services.x86_64 0:1.4.21-16.el7                                                        

Dependency Updated:
  iptables.x86_64 0:1.4.21-16.el7                                                                 

Complete!
[root@linuxhelp ~]# systemctl mask firewalld
[root@linuxhelp ~]# systemctl enable iptables
ln -s ' /usr/lib/systemd/system/iptables.service'  ' /etc/systemd/system/basic.target.wants/iptables.service' 
[root@linuxhelp ~]# systemctl enable ip6tables
ln -s ' /usr/lib/systemd/system/ip6tables.service'  ' /etc/systemd/system/basic.target.wants/ip6tables.service' 
[root@linuxhelp ~]# systemctl stop firewalld
[root@linuxhelp ~]#
[root@linuxhelp ~]# systemctl start iptables
[root@linuxhelp ~]#
[root@linuxhelp ~]# systemctl start ip6tables
[root@linuxhelp ~]#

Allow the default ftp port " 21" in the firewall or router.
Open and add the following line in the " iptables" file in /etc/sysconfig/

[root@linuxhelp ~]# vim /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

Save and exit the file.
Restart iptables.

[root@linuxhelp ~]# vim /etc/sysconfig/iptables
[root@linuxhelp ~]# systemctl restart iptables
[root@linuxhelp ~]# systemctl restart ip6tables
[root@linuxhelp ~]#

Go to the client systems to install filezilla package.

On Debian based derivatives

sudo apt-get install filezilla

On RHEL based systems

[root@linuxhelp ~]# yum install epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.webwerks.com
 * extras: centos.webwerks.com
 * updates: centos.webwerks.com
Resolving Dependencies
-->  Running transaction check
--->  Package epel-release.noarch 0:7-6 will be installed
-->  Finished Dependency Resolution

Dependencies Resolved
.
Installed:
  epel-release.noarch 0:7-6                                                                       

Complete!

Install the filezilla using the following command

[root@linuxhelp ~]# yum install filezilla
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.webwerks.com
 * epel: epel.mirror.net.in
 * extras: centos.webwerks.com
 * updates: centos.webwerks.com
Resolving Dependencies
-->  Running transaction check
--->  Package filezilla.x86_64 0:3.7.4.1-1.el7 will be installed
-->  Processing Dependency: libwx_gtk2u_xrc-2.8.so.0(WXU_2.8)(64bit) for package: filezilla-3.7.4.1-1.el7.x86_64
-->  Processing Dependency: libwx_gtk2u_core-2.8.so.0(WXU_2.8)(64bit) for package: filezilla-3.7.4.1-1.el7.x86_64
-->  Processing Dependency: libwx_gtk2u_aui-2.8.so.0(WXU_2.8.5)(64bit) for package: filezilla-3.7.4.1-1.el7.x86_64
-->  Processing Dependency: libwx_gtk2u_aui-2.8.so.0(WXU_2.8)(64bit) for package: filezilla-3.7.4.1-1.el7.x86_64
-->  Processing Dependency: libwx_gtk2u_adv-2.8.so.0(WXU_2.8)(64bit) for package: filezilla-3.7.4.1-1.el7.x86_64
.
.
.
Installed:
  filezilla.x86_64 0:3.7.4.1-1.el7                                                                

Dependency Installed:
  wxBase.x86_64 0:2.8.12-20.el7                    wxGTK.x86_64 0:2.8.12-20.el7                   

Complete!

Open Filezilla client from your client system by using Alt+f2


Enter the FTP server hostname or IP Address, username, password and port number. Click “ Quickconnect” to login.

Here, the ftp connected without any error, if error occurs then follow the below steps.

Step 1

Go to Edit -> Settings -> FTP -> Active Mode.
Click “ Ask your operating system for the external ip address” in the Active Mode tab.

Go to Edit -> Settings -> FTP -> Passive Mode. Choose “ Fall back to active mode” and click Ok.

Step 2:

If the problem still persists, Go to the FTP server and edit the “ iptables-config” file.

[root@linuxhelp ~]# vim /etc/sysconfig/iptables-config

And change the following line.

# Load additional iptables modules (nat helpers)
#   Default: -none-
# Space separated list of nat helpers (e.g. ' ip_nat_ftp ip_nat_irc' ), which
# are loaded after the firewall rules are applied. Options for the helpers are
# stored in /etc/modprobe.conf.
IPTABLES_MODULES=" ip_conntrack_ftp" 
[...]

Save the iptables rules

And restart the firewall:

[root@linuxhelp ~]# systemctl restart iptables
[root@linuxhelp ~]#

Now, try again from Filezilla

To Access FTP server from Browser

Open the browser and navigate to ftp://< IP_Address> /. Enter the ftp username and password.

[root@linuxhelp ~]# firefox
(process:47847): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0'  failed

Now you can view the contents in your FTP server.

To Log in as a particular user

Navigate to ftp://< username@IP_Address> /


The FTP server ready now.

Comment
imranshamim
Jan 30 2018
Boolean ftp_home_dir is not defined
Add a comment
FAQ
Q
How can I enable anonymous logins in FTP using Filezilla?
A
Just create an account with the name anonymous and make sure the password box isn't checked on that account.
Q
Why I can't connect to my server in FileZilla using FTP?
A
The most likely incorrect configuration of either FileZilla, your firewall, your router or a combination of it.
Q
How do you make multiple users land in the same directory?
A
Specify the directory in this path "local_root=/path/to/directory/"
Q
Is it safe for all user and groups settings to upgrade from older Filezilla server?
A
Yes, installing a new version over an older version does not change any settings.
Q
How can I share multiple drives in FileZilla?
A
Let's assume the server's home directory is set to C:\ftproot and you want to make your picture collection in D:\mypictures available as /pictures. Add D:\mypictures and select its entry. Next add /pictures in the alias column. Now the server will display D:\mypictures