(Solved) How to install VSFTPD on Ubuntu and configure it.

How to install VSFTPD on Ubuntu and configure it.

ftp


FTP is used to transfer files from one host to another over TCP network. This article explains how to set up FTP(VSFTPD) server on ubuntu. These instructions are very easy for installing the VSFTPDon Ubuntu.

Prerequisites: sudo user to do all the stuff.

First, go to root mode and run update package before installing the server to get all packages up to date.
sudo -i
apt-get update

Install the VSFTPD server.
apt-get install vsftpd

First, check to make sure the server is up and running or not before making any changes.
netstat -a | grep ftp

You can see output like this after running the netstat command.
tcp        0      0 *:ftp                   *:*                     LISTEN

First, make a backup copy of the config file.
cp -a /etc/vsftpd.conf /etc/vsftpd.conf.original

For configure edit vsftpd.conf.
nano /etc/vsftpd.conf

Change 2 lines like this on the beginning of the config file.
listen=YES
#listen_ipv6=NO

Add the following lines to the end of the /etc/vsftpd.conf file and replace your server IP to x.x.x.x.
# VSFTPD configuration.
port_enable=YES
pasv_addr_resolve=YES
pasv_address=x.x.x.x
pasv_min_port=6000
pasv_max_port=7000
chroot_local_user=YES
chroot_list_enable=NO
write_enable=YES
local_enable=YES
allow_writeable_chroot=YES
chmod_enable=YES
local_umask=002

Save nano using ctrl+x,  And press y.

Create demo.com folder in  /var/www/html

mkdir /var/www/html/demo.com

Create User, Password & add it to the www-data group.
useradd -M demo
passwd demo
adduser demo www-data

Change ownership of the folder.

chown -R www-data:www-data /var/www/html/demo.com/

Set users to default FTP folder, Such as /var/www/demo.com after login.
usermod -d /var/www/html/demo.com/ demo

Verify permission & ownership of the directory.
ls -l /var/www/html/demo.com

Save the config file and restart the server.
sudo service vsftpd restart

You will see something like this.
vsftpd stop/waiting
vsftpd start/running, process 1649

You will need to open up ports both on your server firewall &  security group to be able to connect. 
TCP Ports 21
TCP Ports 6000 - 7000

Note:- After uploading files in FTP you must change Permission and ownership of the file, like this to edit the file using FTP user.
sudo chown -R www-data:www-data /var/www/html/demo.com/
sudo find /var/www/html/demo.com/ -type d -exec chmod 775 {} \;
sudo find /var/www/html/demo.com/ -type f -exec chmod 664 {} \;


Open FTP port on your EC2 Instance. Configure like this.


After this setting test port is opened or not using this link.

www.yougetsignal.com/tools/open-ports/

If everything ok then open filezilla & set port like this connection.



Now you can connect your FTP.



SHARE

Ibrar Ansari

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment