Web Development

Setting up a FTP server

We would be installing a stronger version of ftp server which is called vsftpd. The first two letters of vsftpd stand for "very secure" and the program was built to have strongest protection against possible FTP vulnerabilities.

Step One—Install vsftpd

Install vsftpd on your virtual private server in the command line:

sudo apt-get install vsftpd

Step Two—Configure vsftpd

Open up the configuration file:

sudo vim /etc/vsftpd.conf

Make the following changes to the file

anonymous_enable=NO

Prior to this change, vsftpd allowed anonymous, unidentified users to access the server's files.

local_enable=YES

write_enable=YES

Uncomment the line to chroot_local_user.

Because of a recent vsftpd upgrade, vsftpd is "refusing to run with writable root inside chroot". A handy way to address this issue to is to take the following steps:

Create a new directory within the user's home directory

mkdir /home/username/files

Change the ownership of that file to root

chown root:root /home/username

Make all necessary changes within the "files" subdirectory

Then, as always, restart:

sudo service vsftpd restart

Step Three—Access the FTP server

Type the domain name into the address bar and logging in with the appropriate ID. Keep in mind, you will only be able to access the user's home directory.

ftp://example.com

Alternatively, you can reach the FTP server on your virtual server through the command line by typing:

ftp example.com

IF YOU KEEP GETTING A LOGIN ERROR (530 ERROR) EVEN AFTER TRYING ALL THE STUFF ON THE INTERNET TRY THE FOLLOWING COMMANDS

sudo apt-get remove vsftpd

sudo rm /etc/pam.d/vsftpd

sudo apt-get install vsftpd

I was pulling my hair out for a day to resolve this problem :)