Posts Tagged ‘vsftpd’

Installing and configuring vsftpd

To perform ftp file transaction it is required to install a ftp server and configure it appropriately. The vsftpd server is used in this scenario.

First install the vsftpd server – sudo apt-get install vsftpd

Configure the vsftpd server by editing the /etc/vsftpd.conf file

listen=YES

anonymous_enable=NO

local_enable=YES

write_enable=YES

anon_mkdir_write_enable=NO

dirmessage_enable=YES

use_localtime=YES

xferlog_enable=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/private/ssl-cert-snakeoil.key

pasv_enable=YES

pasv_min_port=11810

pasv_max_port=11819

pasv_address=<public external ip address of the machined where vsftpd is installed>

 

Open the port ranges 20-21 and 11810-11819 of the machine

Finally restart the vsftp server – sudo service vsftpd restart.

 

FTP user accounts

I created  two user accounts to send and receive files with login disabled (This is not required)

sudo adduser ftpuser1 –disabled-login

sudo adduser ftpuser2 –disabled-login

 

Create the following directory structure

/home/ftpuser1/files/in      /home/ftpuser1/files/out

/home/ftpuser2/files/in      /home/ftpuser2/files/out

 

Change the change file owner to respective users

chown -R ftpuser1 /home/ftpuser1/files

chown -R ftpuser2 /home/ftpuser2/files