File Transfer Protocol (FTP) is a standard network protocol used to transfer files from one host to another over a TCP-based network, such as the internet. An FTP server is a computer that is running FTP server software and is connected to a network. It stores and manages files that can be accessed and transferred over the network using FTP clients. FTP servers are often used to transfer files between computers or to transfer large files that are too large to be sent as email attachments.

To access an FTP server, you will need an FTP client, which is a piece of software that allows you to connect to and transfer files from an FTP server. There are many FTP clients available, both free and paid, and they can be used on a variety of operating systems. Once you have an FTP client, you can connect to the FTP server by entering the server’s address, your username, and your password. From there, you can browse the files and directories on the server, upload and download files, and perform other file-related tasks.

Overview:

  1. Update system packages
  2. Install vsftpd Server on Ubuntu
  3. Backup Configuration Files
  4. Create FTP User
  5. Configure and secure vsftpd server
  6. Restart vsftpd server (FTP)

Steps:

1. Update system packages

To update your repositories run the below command in terminal

sudo apt update

2. Install vsftpd Server(FTP) on Ubuntu

To install vsftpd, run below command

sudo apt install vsftpd -y

3. Backup Configuration Files

Before making any changes, make sure to back up your configuration files. Run below command to create backup.

sudo mv /etc/vsftpd.conf  /etc/vsftpd.conf_default

4. Create FTP User

Create a new FTP user using the below command.

sudo useradd -m ftp-user
sudo passwd ftp-user

you’ll be prompted to create a password for the user ftp-user account.

Note: Make sure to allow access on Port 20 and Port 21 in your cloud provider firewall. These are the listening ports for the FTP service.

5. Configure and secure vsftpd server

Create vsftpd.conf file with the below content

sudo vi /etc/vsftpd.conf
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
force_dot_files=NO
pasv_min_port=40000
pasv_max_port=50000
anon_upload_enable=NO
anon_mkdir_write_enable=NO
file_open_mode=077
allow_writeable_chroot=NO

To change the FTP home directory, enter the following.

sudo mkdir /ftp-dir
sudo usermod -d /ftp-dir ftp-user

6. Restart vsftpd server (FTP)

Restart the vsftpd service to apply the changes.

sudo systemctl restart vsftpd.service

you can check status by using below command.

sudo systemctl status vsftpd.service

Run the below command to start FTP server on system startup.

sudo systemctl enable vsftpd.service

Note: To access you can use FTP Client tools like FileZilla, WinSCP, or a built-in ftp command line utility.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments