Key Points to Remember
FTP (FILE TRANSFER PROTOCOL)
1. Install the package.
2. Create some files in /var/ftp/pub directory (Server Side).
3. Restart the service.
4. Make the service enable even after reboot of the system.
5. Connect from client and access the files and download it.
[root@server ~] # yum install vsftpd -y
Now, we have to do some changes according to need in main configuration file.
[root@server ~]# vi /etc/vsftpd/vsfptd.conf
# line 12: no anonymous
anonymous_enable= YES / NO (to access ftp server publicly or not)
# line 82,83: uncomment ( allow ascii mode )
ascii_upload_enable=YES ascii_download_enable=YES
# line 100, 101: uncomment ( enable chroot )
chroot_local_user=YES chroot_list_enable=YES
# line 103: uncomment ( specify chroot list )
chroot_list_file=/etc/vsftpd/chroot_list
# line 109: uncomment
ls_recurse_enable=YES
# line 114: change ( if use IPv4 )
listen=YES
# line 123: change ( turn to OFF if it's not need )
listen_ipv6=NO
# add follows to the end
# specify root directory (if don't specify, users' home directory become FTP home directory)
local_root=public_html
# use localtime
use_localtime=YES
# turn off for seccomp filter (if you cannot login, add this line )
seccomp_sandbox=NO
Now Start , enable the vsftpd service by using a below command and check the status.
[root@server ~]# systemctl start vsftpd.service
[root@server ~]# systemctl enable vsftpd
[root@server ~]# systemctl status vsftpd
Check and see whether port 21 is open or not
[root@server ~]# netstat -tulpn |grep -i listen or
[root@server ~]# netstat -tulpn |grep -i vsftpd
We also need to open firewall port otherwise you will see following error message when we are going to connect:
To open a port 21 on RHEL - 7 use below commands.
The port will remain open to public even after system restart
Now, Copy or create some files in “/var/ftp/pub” directory Navigate to /var/ftp/pub directory and create some files in it.
root@server ~]# cd /var/ftp/pub
[root@server pub]# touch file{1..5}.txt
[root@server pub]# ls
file1.txt file2.txt file3.txt file4.txt file5.txt
Now connect from client side and access the files and download it.
To install ftp package either download it from epel repo (online) or install it from RHEL7 Repo or else you can create your own repo.
Move to the package folder and installed it by using below rpm command
Here package path is /run/media/root/RHEL-7.0 Server.x86/Packages
So we need to go this path first.
[root@client Packages]# cd /run/media/root/RHEL-7.0 Server.x86/Packages
Now, install ftp package by using rpm command.
[root@client Packages ] # rpm -ivh ftp-0.17-66.el7.x86_64.rpm
check it ftp package is installed or not.
[root@client ~]# cd
[root@client ~]# rpm -q ftp
Now, connect to FTP server using its server IP,
Use “ftp or anonymous” as login name Press enter without giving any password
go to pub directory and check the files available
ftp> cd pub
ftp>ls
The cause of the above error is a missing ip_conntrack_ftp kernel module.Quick fix solution is to load this module using modprobe.
Now, go to the server side and run below command
[root@server ~]# modprobe ip_conntrack_ftp
Now,Go to the client side and login with ftp server.
Here we have successfully fix no route to host issue, now download above files using get or mget command.
get : - to download one file.
mget:- to download multiple files.
Exit the ftp server and check whether files are there or not.
To exit the ftp server use bye or quit command.
If you want to download files from web browser then Connect to ftp server graphically open web browser like firefox type ftp server ip address as follows,
Click on pub folder you will see some files and then press right click button of mouse on any file and click on save as link , you will see files in download folder.
Comments