FTP (File Transfer Protocol)

Sourabh Dey
4 min readJan 16, 2022

Part 1

File Transfer Protocol

File Transfer Protocol :

FTP (File Transfer Protocol) is a network protocol for transmitting files between computers over Transmission Control Protocol/Internet Protocol (TCP/IP) connections. Within the TCP/IP suite, FTP is considered an application layer protocol.

In an FTP transaction, the end user’s computer is typically called the local host. The second computer involved in FTP is a remote host, which is usually a server. Both computers need to be connected via a network and configured properly to transfer files via FTP. Servers must be set up to run FTP services, and the client must have FTP software installed to access these services.

Configuration :

Server Site

First Check Your Local Yum Repository LIst

In My Case I user Red Hat Machine as a server

Package Requirement

ftp , vsftpd

It will install the all the relevant Package on your system

Now go to the vsftpd Configuration file & Change some configuration

Path : /etc/vsftpd/vsftpd.conf

As you can see I change the anonymous login enable to yes

Start and Enable the Services

As you can see service is running and active

Now Add the Services to the Firewall

It will resolve any issue if it occurs due to the firewall

Now let’s just put some file in the default FTP File Location /var/ftp/

As you can see there are two files in the server site

Client Site

Now access the ftp server

In my case it is Linux , You can use Windows To :)

I used Cent OS Machine as a Client

Open a Terminal Make Sure all the Packages in client site also installed Like (vsftpd ,ftp)

Type ftp server_ip in the client site

Username: anonymous

Passwd: Blank {Because we allow anonymous share log in enabled }

Bingo we are in

Now let just see those two files are located or not

Bingo they are here but I how to access those file in our client machine
For that they are commands available like get

Some Command Explanation that are frequently Used :

get : To download file from the server to the client end

put : To upload files from the client to the server end

mget : To Download Multiple files from the server to client site

mput : To upload Multiple Files from the Client to server

The file downloaded and stored in your client site machine
Bingo the file stored in our client site machine

AdditionalConfiguration

1. You can change the anonymous user login by entering NO in the /etc/vsftpd/vsftpd/conf But it’s not recommended in the actual enviroment because due to that client can access the home directory of the particular user of the server site end so it’s better to enable the anonymous log in share

2. You can change the default ftp file location i.e /var/ftp to anything else like this :

(2.1) First create a directory in home folder which you want to make a default folder for the ftp and put some changes in the vsftpd.conf file with anonymous login share Practical Explanation

Server Site Configuration

Make directory in / folder
Here I put the new file path for the anonymous log in means now when the client enter into the server he will enter into the /ftp folder .

Restart the ftp service

But keep in mind that you there are plenty of malfunction arises if you login to this time because selinux will block your connection /Access

First check the default selinux configuration to the ftp default path

As you can simply see /var/ftp/pub configuration is public_content while our /ftp folder configuration is default_t

We have to change that using chcon command

-t used for targeted .

Again restart the vsftpd service

First put some file in the new default path configuaration in server end

Server Site

I created a new file in the server site

Client Site

Bingo the file is here

To Revert Change just comment this line in the configuration of ftp in server end

Comment the last line by putting # in the beginning of the line

Done :)

--

--

Sourabh Dey

Trying To learn as much as possible about different Techonology. About me I am just a normal Boy who lives in terminal