How to install an FTP Server on Ubuntu 22.04 using VSFTPD
- 00:47 lsb_release -a
- 01:23 sudo apt install vsftpd
- 01:43 systemctl start vsftpd
- 01:57 systemctl enable vsftpd
- 02:11 sudo ufw allow ftp
- 02:27 sudo ufw allow 20/tcp
- 02:37 sudo ufw allow 21/tcp
- 02:52 sudo ufw status
- 03:11 sudo adduser ftpserver
- 03:45 sudo mkdir /home/ftpserver/ftp
- 04:03 sudo chmod a-w /home/ftpserver/ftp
- 04:27 sudo mkdir /home/ftpserver/ftp/file
- 04:56 sudo chown ftpserver:ftpserver /home/ftpserver/ftp/file
- 05:30 echo "ftpserver" | sudo tee /home/ftpserver/ftp/file/sample.txt
- 05:43 vim /etc/vsftpd.conf
- 06:09 vim /vsftpd.chroot_list
- 06:32 systemctl restart vsftpd
- 06:42 ifconfig
To install an FTP Server on Ubuntu 22.04 using VSFTPD
Introduction
FTP (File Transfer Protocol) is a standardized network protocol employed for transferring files between hosts over a TCP-based network, such as the Internet. It operates by establishing two connections that link the communicating computers. FTP facilitates the downloading, uploading, and transfer of files between locations on the internet and across computer systems.
Procedure
Step 1 : Check the OS version of the system
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
Step 2: Check for update and install
root@linuxhelp:~# sudo apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [513 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,888 kB]
Fetched 14.7 MB in 6s (2,379 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
339 packages can be upgraded. Run 'apt list --upgradable' to see them.
Step 3: Insatll vsftpd package using the below command
root@linuxhelp:~# sudo apt install vsftpd
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
Get:1 http://in.archive.ubuntu.com/ubuntu jammy/main amd64 vsftpd amd64 3.0.5-0ubuntu1 [123 kB]
Fetched 123 kB in 1s (88.2 kB/s)
Preconfiguring packages ...
Selecting previously unselected package vsftpd.
(Reading database ... 203969 files and directories currently installed.)
Preparing to unpack .../vsftpd_3.0.5-0ubuntu1_amd64.deb ...
Unpacking vsftpd (3.0.5-0ubuntu1) ...
Setting up vsftpd (3.0.5-0ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /lib/systemd/system/vsftpd.service.
Processing triggers for man-db (2.10.2-1) ...
Step 4: Start the FTP server using the below command
root@linuxhelp:~# systemctl start vsftpd
Step 5: Enable FTP server using the below command
root@linuxhelp:~# systemctl enable vsftpd
Synchronizing state of vsftpd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable vsftpd
Step 6: Allow FTP in firewall using the below command
root@linuxhelp:~# sudo ufw allow ftp
Rule added
Rule added (v6)
Step 7: Allow FTP ports in firewall using the below commands
root@linuxhelp:~# sudo ufw allow 21/tcp
Skipping adding existing rule
Skipping adding existing rule (v6)
root@linuxhelp:~# sudo ufw allow 20/tcp
Rule added
Rule added (v6)
Step 8: check whether the FTP ports are allowed in firewall using the below command
root@linuxhelp:~# sudo ufw status
Status: active
Output:
To Action From
-- ------ ----
Samba ALLOW Anywhere
21/tcp ALLOW Anywhere
20/tcp ALLOW Anywhere
Samba (v6) ALLOW Anywhere (v6)
21/tcp (v6) ALLOW Anywhere (v6)
20/tcp (v6) ALLOW Anywhere (v6)
Step 9: Add ftpuser using the below command
root@linuxhelp:~# sudo adduser ftpserver
Adding user `ftpserver' ...
Adding new group `ftpserver' (1002) ...
Adding new user `ftpserver' (1002) with group `ftpserver' ...
Creating home directory `/home/ftpserver' ...
Copying files from `/etc/skel' ...
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: password updated successfully
Changing the user information for ftpserver
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y
Step 10: Create FTP directory inside home directory of the ftpserver using the below command
root@linuxhelp:~# sudo mkdir /home/ftpserver/ftp
Step 11: Give writable permission to FTP directory using the below command
root@linuxhelp:~# sudo chmod a-w /home/ftpserver/ftp
Step 12: Create file directory inside FTP using the below command
root@linuxhelp:~# sudo mkdir /home/ftpserver/ftp/file
Step 13: Change the ownership of file directory as ftpserver user which we had created before, using the below command
root@linuxhelp:~# sudo chown ftpserver:ftpserver /home/ftpserver/ftp/file
Step 14: Create sample.txt file and insert the line “ftpserver” using the below command
root@linuxhelp:~# echo "ftpserver" | sudo tee /home/ftpserver/ftp/file/sample.txt
ftpserver
Step 15: Search for vsftpd.chroot_list inside vsftpd.conf using the below command
root@linuxhelp:~# vim /etc/vsftpd.conf
Step 16: Edit the chroot_list and enter the ftpuser name inside vsftpd.chroot_list using the below command
root@linuxhelp:~# vim /vsftpd.chroot_list
Step 17: Restart FTP server using the below command
root@linuxhelp:~# systemctl restart vsftpd
Step 18: Check the IP address of our system using the below command
root@linuxhelp:~# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.6.133 netmask 255.255.254.0 broadcast 192.168.7.255
inet6 fe80::ed65:e6a5:ee5d:b483 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:a5:b2:f5 txqueuelen 1000 (Ethernet)
RX packets 12715 bytes 16285554 (16.2 MB)
RX errors 0 dropped 34 overruns 0 frame 0
TX packets 2394 bytes 204467 (204.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Step 19: Open the command line interface and enter the FTP credentials to connect the ftp server.
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to install an FTP Server on Ubuntu 22.04 using VSFTPD. Your feedback is much welcome.
Comments ( 0 )
No comments available