X

Rate Us :



Share with Friends :

Menu

File Transfer Protocol(FTP) :

FTP is one of the oldest member of the TCP/IP protocol stack and it is still in common use. As the name suggest, it is optimized for transferring files.

It is a default service in Linux OS which is used to upload and download files to multiple client systems.

Client can access the resources with the help of uploading and downloading in CLI or GUI mode.

Generally, FTP server configure in LAN and WAN.


X

LAN :

A local area network (LAN) is a computer network that interconnects computers within a limited area such as a residence, school, laboratory, or office building.

X

WAN :

A wide area network (WAN) is a telecommunications network or computer network that extends over a large geographical distance. Wide area networks are often established with leased telecommunication circuits.

Types of FTP services :


  • VSFTPD => Very Secure FTP Daemon




  • WU-FTPD => Washington University's (St. Louis) FTP




  • ProFTPD => Professional FTP Daemon




Requirements :


Installation package : vsftpd*.rpm Port numbers : 20 (Data transfer) , 21 (Control connection) Configuration file : /etc/vsftpd/vsftpd.conf Service/Daemon : vsftpd

FTP Commands : ls - List the contents of a directory lcd - Change directory (local directory) put - To upload a single file mput - To upload multiple files get - To download a single file mget - To download multiple files bye - To quit


Configure FTP server :


FTP Server System : Check the system IP address - [root@localhost~]#ifconfig [Let say, IP address - 192.168.0.180] Install the packages for FTP server - [root@localhost~]#yum install vsftpd* -y Create files for downloading - [root@localhost~]#touch /var/ftp/pub/file{1..10} Create a directory with full permission for upload - [root@localhost~]#mkdir -m 777 /var/ftp/dir1 Edit the configuration file - [root@localhost~]#vi /etc/vsftpd/vsftpd.conf Set the line number - Go to Esc mode by pressing Shift + : and then type se nu Go to Line no. - 12, 16 and 29 and edit by going to insert mode by pressing Esc then i/I/o/O/a/A (any one of them) 12 anonymous_enable = YES 16 local_enable = YES 29 [remove # symbol to enable (anonymous_upload_enable = YES)] Then go to Ex: mode by pressing Esc then Shift + : and type wq to save and exit. Update the service - [root@localhost~]#service vsftpd restart FTP Client System : Download files from the server to client system :- Connect to FTP server - [root@localhost~]#ftp192.168.0.180 Name (192.168.0.180:root): ftp Password: [Enter] (as ftp is anonymous) ftp> cd pub ftp> ls ftp> get file1 [file will be download to the client's default directory] ftp> prompt ftp> mget file* ftp> ! [or use 'bye' to exit] [root@localhost~]#pwd [root@localhost~]#ls Upload files from the client to server system :- Create files in client system - [root@localhost~]#touch cfile{1..10} Connect to FTP server - [root@localhost~]#ftp192.168.0.180 Name (192.168.0.180:root): ftp Password: [Enter] (as ftp is anonymous) ftp> cd dir1 ftp> put cfile1 ftp> mput cfile* ftp> ! [or use 'bye' to exit] Check the uploaded files in server system - [root@localhost~]#ls /var/ftp/dir1 Block the system or specific IP address to access FTP server : In FTP server system edit hosts.deny file - [root@localhost~]#vi /etc/hosts.deny Go to end of the file and edit by going to insert mode by pressing i/I/o/O/a/A (any one of them) vsftpd:192.168.0.1 Then go to Ex: mode by pressing Esc then Shift + : and type wq to save and exit. Go to client system and check the output - [root@localhost~]#ftp192.168.0.180 [service not available]