Installing VSFTPD in Ubuntu 20.04/18.04 Servers
Introduction:
Todays article, We are going to discuss about the FTP server installation on Ubuntu based systems. We have VSFTP Server Ubuntu, Which is ftp server. So we will look at the VSFTP server installation and configuration process on Ubuntu.
VSFTPD Installation on Ubuntu 20.04/18.04 :
Install the FTP server using the following command.
1 |
apt-get -y install vsftpd |
Configuring VSFTPD Server :
Open the vsftpd Configuration File.
1 |
vim /etc/vsftpd.conf |
Now change the following parameters like below.
We are not going to allow Anonymous logins, So set anonymous_enable=NO. Similarly change the following parameters as well.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
anonymous_enable=NO local_enable=YES write_enable=YES # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=NO chroot_local_user=YES # if you get 500 Internal error for ftp server add following line. allow_writeable_chroot=YES # if you get login incorrect error edit the pam_Service_name to ftp from vsftpd pam_service_name=ftp |
make the above changes and save the file
Now Create the FTP user :
Create a user to access the ftp server. Here i am creating the ftpuser user.
1 |
useradd -d '/var/www/html' -s /sbin/nologin ftpuser |
change the password for the user.
1 |
passwd ftpuser |
Now give all permissions on the home directory, Here i am going to host some files in /var/www/html/ are giving permission for ftpuser on /var/www/html/
1 2 |
chown -R ftpuser '/var/www/html/' chmod 775 '/var/www/html/ |
Create a ftpusers group and then add ftpuser to ftpusers group.
1 2 |
groupadd ftpusers usermod -G ftpusers ftpuser |
Open the firewall port 21 for FTP
1 |
ufw allow 21 |
Now restart the vsftpd server
1 |
sudo service vsftpd restart= |
Then try to connect to the FTP server using any FTP client such as FileZilla with the ftpuser credentials.
If anybody gets Apache 403 forbidden Error,
Use /etc/vsftpd.conf
local_umask=022
Re user creation: in Ubuntu 14.04.2 LTS, there is no script /sbin/nologin; you will need to use /usr/sbin/nologin instead.