Install and Configure FTP in Ubuntu 18
Note: At all stages, the commands are logged with Root access, so if you are logged in to Ubuntu 18 by any other user than the Root user, you should enter all commands after the Sudo command.
1- Connect to your Ubuntu 18 via an SSH client.
2. Type the following command to update Ubuntu 18 repositories.
3. After completing the above steps, enter the following command to download and install the VSFTP service.
apt install -y vsftpd
4. After the installation is completed, enter the following commands to start the VSFTP service and start up your Ubuntu installation.
systemctl start vsftpd
systemctl enable vsftpd
So far we were able to install FTP on Ubuntu. Let's learn how to set up this service as well as grant access to users to use FTP.
Configuring FTP in Ubuntu 18
First, create an account and set up a password for it.
useradd -m abtin
After entering the second command, you must enter the password twice for this user.
2. Rename the default VSFTP file so that it can be restored in case of an error.
3. Create a new configuration file for VSFTP and open it with an editor. (In our command, we used the nano editor, but you can also use the Vi editor or any other available editor).
4. Copy the following file into the opened file and save and exit at the end of the file.
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
rsa_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file = /etc/ssl/privacy/ssl-cert-snakeoil.key
ssl_enable = NO
pasv_enable = Yes
pasv_min_port = 10,000
pasv_max_port = 10100
allow_writeable_chroot = YES
5. When the file is finished editing, enter the following command to restart the VSFTP service once.
systemctl restart vsftpd
6. With this current configuration, you will have access to the root user interface with which you log into FTP.
For example, the address of this directory is for elizabet user: home / elizabet /
This way you have been able to set up FTP on your Ubuntu.
In the end, you only need to configure the ports for this service on your firewall.
Configure the Ubuntu Firewall 18 to use the FTP service
To get FTP service, enter the following commands to open all necessary ports.
Note: Dear user, the following commands are listed in the Ubuntu 18 standard for UFW setup. If you use another firewall, you must open the ports required by the following commands in accordance with the same firewall.
ufw allow 20 / tcp
ufw allow 21 / tcp
ufw allow 990 / tcp
ufw allow 10,000: 10100 / tcp
After that, you can connect to your FTP server. If you need to learn more about FTP click here.
We hope you'll use the installation process and FTP setup in Ubuntu 18 at the end of the tutorial.