iA


Step Three: Connecting to your server with an FTP client

by Andy Boyle.

Now that you’ve set up your Ubuntu server, installed Django and set up your app, now it’s time to actually code the damn thing. But first you need to learn how to FTP into your server with an FTP client.

What’s that, you askt? It’s the thing you use to connect to the server, edit files, upload stuff, etc. It’s sweet.

Oh, also: I’ve also decided at this point that I’m not going to focus at all on setting stuff up on a Windows computer. Sorry. It’s just too damn difficult. Either install Linux, buy a Mac or pick something else to do.

LOGGING IN WITH A FTP CLIENT

I’m being lazy, so I’m going to just show you how to connect with FTP. Yes, everyone will tell you that SFTP is better. It is safer. It is more secure. But dammit, let me be lazy right now. You can learn more about using SFTP with AWS and Coda here.

We’re going to use vsftpd. First, ssh into your server. Then type this to download and install vsftpd:

sudo apt-get install vsftpd

Then you’re going to need to edit your permissions and add a user.

So let’s create a user.

sudo adduser somename

It will then ask you to enter in a password — which you need to remember — and then other information. The password is the only thing you should really care about, feel free to hit enter on everything else.

Next we’re going to want to give that person sudo power, so you can stop logging in as ubuntu. Do this:

cd /etc

sudo nano sudoers

This will take you into a text editor to edit your sudoers file, which is where the sudo permissions live. Some people use different text editors, but this is my goddamn tutorial, and we’re using nano, dammit.

Here’s what your screen looks like:

Now, with your arrow keys, scroll down to underneath root. You’re going to add that username you added previously, and then type ALL=(ALL) ALL after it, so basically it’s copying what the root has.

somename    ALL=(ALL) ALL

Type Ctrl + O to save, then Ctrl + X to exit. Bam. You just made a user. You’re super awesome.

Now let’s edit your permissions. Go here for more information on this.

sudo nano vsftpd.conf

Now, for security reasons (I say this as I teach you how to use FTP, ha ha ha), change this line

anonymous_enable=YES

to this

anonymous_enable=NO

Then uncomment this line by deleting the # from them (that is how you uncomment stuff, by the way):

write_enable=YES

Then Ctrl + O followed by Ctrl + X. Next, enter in this command:

sudo /etc/init.d/vsftpd start

Now you can FTP in using FileZilla, which is what we’re going to use. I would suggest you go and buy Coda, but you don’t have to. I do. As do other cool people.

So open up FileZilla after you download and install it. Click the top left icon above the word “Host.” Click new site, give it a name. For the Host field, you need to put your IP address of your AWS instance. You find that by looking at AWS server name, which was something like ec2-40.10.10.10.compute-1.amazonaws.com. In this instance, the IP would be 40.10.10.10.

User is the username you created up there, and password is the password. Server type should be FTP. Click on Transfer Settings, and change it to “Active.” Now click Connect.

This should look familiar. It’s the structure of the files. Voila. You have now set up vsftpd, learned the very basics of using nano to edit stuff in the terminal and FTPd to your server. Next you will learn how to set up your models.py file. So move on to Step Four.

4 comments on ‘Step Three: Connecting to your server with an FTP client’

  1. [...] This post was mentioned on Twitter by Dave Stanton, Serdar Tumgoren. Serdar Tumgoren said: Nice. Sharing the knowledge: RT @andymboyle: Step 3 of Django app walk-thru: Connect to server with an FTP client — http://bit.ly/dH6NpL [...]

  2. scottric says:

    Wow, somebody be hatin’ on the Windoze…. Of course, I do not blame you in the slightest…..

  3. Tom Meagher says:

    Andy,
    This is great, but I found a few tweaks to add.
    First, they no longer allow the script to start vsftpd to be run out of /etc/init.d/. Instead, you need to use “sudo service vsftpd start ”

    Also, I had to tweak the security settings for ssh and ftp under the Network & Security/Security Groups tab.
    Create an SSH rule for the source IP of 0.0.0.0/0.
    Then create three separate rules allowing 0.0.0.0/0 to access ports 20, 21 and 1024 – 1048 in order to be able to login with FTP.

    Otherwise, everything’s worked splendidly. On to the next step.
    Thank you!
    Tom

  4. David says:

    Macrosloth user here. Was able to connect without much trouble. Of course I had to open up the ports in Amazon security settings. Also, I had to go to file->site manager in Filezilla, set up the server and force it to use active ftp.

Leave a Reply