Friday, January 1, 2021

How to congigure File Transfer Protocol Server (FTP)

 

 FTP server :
(a).FTP Server is used  upload and download the files and directories cannot be downloaded.
(b).The FTP server package is  vsftpd.The FTP client packages are ftp and lftp and deamon is vsftpd .
(c)Port numbers 20 for data connection and 21 for FTP command connection.


Configure FTP SERVER

Step1: Install the package

           root@server~#yum install vsftpd* -y

Step2: Start servies
            
           root@server~#systemctl start vsftpd

Step3: Copy or create some files in “/var/ftp/pub” directory

                        root@server~#cd /var/ftp/pub
                        root@server~#touch file{1..5}


Step4: Restart servies and add ftp service in firewall
            
           root@server~#systemctl restart vsftpd


           root@server~# firewall-cmd --permanent -add-service=ftp 
           root@server~# firewall-cmd --complete-reload

Configure the FTP client and  connect the ftp server:-

Go to the client machine and install the FTP

                             root@server~#yum install ftp* -y

Connect the FTP server from client.

Example : # ftp  192.168.0.10 or ftp://server.example.com
                       Username : ftp
                       Password : <press enter key>
                       ftp > ls
                                         (to see the files in the FTP document root directory)

Configure the Secure FTP server

                 root@server~# vim /etc/vsftpd/vsftpd.conf
Go to line search this
                                          ananymous_enable=no
                                                                                     (save and exit the file)

                                      ananymous_enable=yes         (It is by default)
It means anybody can login to the FTP server without any username and password. then we must provide the username and passwords .

Restart the ftp deamon by

                      root@server~# systemctl restart vsftpd

SET the FTP user password by

                               root@server~# passwd ftp

Go to client side and connect the FTP server by

                             root@server~# ftp 192.168.0.10

Configure the FTP server to upload the files


                              root@server~ # vim /etc/vsftpd/vdftpd.conf

Go to line no :
                                         writable_enable=yes
 
                                       anon_upload_enable=yes
                                                                                  (save and exit the file)
Make the upload directory in /var/ftp/pub directory by -
                                 
                             root@server~ # mkdir /var/ftp/pub/upload

Change the group of the upload directory

                          root@server~ # chgrp ftp upload

Change the permissions of the upload directory by

                             root@server~ # chmod 775 upload

To permanently add the ftp service to SELinux policy by

                             root@server~ # getsebool -a | grep ftp
                                                             (to check the SELinux Booleans for FTP service)
# setsebool -p allow_ftpd_anon_write on
# chcon -t public_content_rw_t upload
(to add read-write context of the upload
directory)






No comments:

Post a Comment