Creating an FTP Server for our Students

By @zachfeldman
Written on Jun 25, 2014

Note: Looking for the source code? It’s right here.

Hello there, everyone! It’s been quite a fun few weeks here at NYCDA , from our Angular + Swift lectures all the way to the AMA I did on Reddit yesterday. That was fun!

I’m here to tell you all about a problem and a solution we devised for it. In all of our classes we teach the most basic method of website deployment: FTP. Don’t worry all of you curmudgeonly git deployment people, we also teach deployment through Git + Heroku later on in the course. However, we think it’s important for students to know about this option and it also gives them an easy method to show off the website projects they’ve been building to the real world.

The problem we faced is how to get 15 students reliable, working FTP accounts that didn’t cost any money at the same time. Turns out that free web hosts can be a bit dodgy. Sometimes they would say a students’ email account was invalid, or perhaps the given password wouldn’t work when logging in, or students were forced to use SFTP but weren’t told. The existing solutions were just not working for us and telling students to find their own free web hosts was not a scalable solution.

I thought to myself that there had to be some easy to deploy FTP serverĀ out there with a friendly front-end. In fact, there probably is, but I was unable to locate anything in a timely manner besides really complicated stuff like installing CPanel or a business-like FTP service that was just to complicated. So I did what most developers do when faced with a situation like this and partially reinvented the wheel!

Too many buttons for web dev beginners!
Too many buttons for web dev beginners!

The first thing I needed was a way to programmatically setup FTP connections on a Linux box connected to the web. I started out with my Raspberry Pi as a host but quickly ran out of space. I spun up the smallest instance Linode had to offer and got to work setting it up as a basic web server. I followed this article and just ignored the parts pertaining specifically to the RaspPi. When all was said and done, I had a basic Apache web server running on my Linode box that I could access from its IP address, serving the test landing page. I proceeded to hook things up through Linode and my domain provider, DNSSimple, so that box could be accessed from an easy to remember domain name.

The next step was figuring out how to configure FTP connections to this box. I settled on using VSFTPD, a popular package for Linux that allows Linux users to act as FTP users or SFTP users into a box. It was easy to configure to my liking. I included the same configuration file I used in the GitHub repository for this project below.

sudo apt-get install vsftpd

After that, it was a matter of building a thin Rails client to run the app itself. This meant signing up users, provisioning accounts for them on the underlying Linux box including a home directory for their files, resetting both their thin client and back-end passwords if they lost the password, and letting them know all of their FTP login information.


For now, the Rails app is running on port 3005 and the root URL redirects to that port. Student websites are served from the base url of the site, so for instance would serve up the user feldman452’s directory.

I decided to white-label the app so that anybody can run their own version of it simply by editing the config/settings.yml file! I’d love to see some pull requests come in with improvements to the service, especially tests to make sure that it is secure.

You can see the code right here on NYCDA’s GitHub account.

X-posted from the New York Code + Design Academy blog.

Sign up for our e-mail list to hear about new posts.