RPi Noob Guide for Wheezy and vsftpd

Page in Development

FTP File Transfer Protocol
During this bit of noob enlightenment you will be hacking around at the innards of Wheezy always remember you can always re-image your SD card and re-start.

NOTE the Win32Image software will allow you to make a backup of your SD card at any stage.

In setting up ftp you make your RPi open to external change but until you set up your router to port forward (something your not doing here) it’s only visible to machines connected to your router.

You should have your router secured with a good password for administration and for wi-fi if it has it.

What is FTP
As this is noob territory we should start with a basic explanation of ftp.

ftp is a way by which you can copy files from one machine to another using the internet or a local switch/router.

Most browsers have some ftp download ability built in, but it is going to be useful to use one of the free tools available.

I use “core ftp le” as this version of core is free for the home user and will probably be all you will ever need.

Core FTP Lite

There is also “Filezilla” which comes from the same software family as firefox.

Filezilla

I personally find core easier.

There are others like ”cute ftp” which is a 30 day trial I think it goes to AnnoyWare after that, but it’s good fairly cheap well supported and stable

Cute FTP

In reality it does not mater which Client you choose.

ftp connects using port 21 something you don’t need to worry about for now, it’s just something you may need if you decide to make your RPi FTP visible across the internet not recommended for the Noob community.

So that is your client end of the deal sorted but to play you need to set up the server end, and for that you need the ftp server software.

Debian Linux and Fedora Linux and their derivatives (Ubuntu, Raspibian, Wheezy etc.) come with a package available via the apt-get (software instalation) route.

The package is vsftpd (Very Secure FTP Daemon) to load it into your Wheezy image you are going to need to run some command line stuff If you are running on a TV using HDMI it may be worth changing the default font or at least till you get familiar with what is going on or run Blind Login both of these set up’s have instructions for the noob on the wiki and will make your life easier and eyesight last longer.

Note neither are essential they just may make your life easier.

OK It looks like neither the Beta or the latest version of Wheezy that is 2012-06-18-wheezy-beta or 2012-07-15-wheezy-raspbian have vsftpd pre installed.

Either way they don’t have the config file in place so the apt-get install will sort that for you.

Installing vsftpd & Editing the vsftpd.conf
Heads up either at the start of the session type

sudo su

run as super user or type sudo before every line it is your choice. When you come to reboot this revert’s to a normal login so “sudo su” can save you typing

I recommend you run

apt-get update

This just insures you are running the latest list of installs for the package you are using.

apt-get install vsftpd

You may get asked about using the extra space it is sort of pointless to say no.

I have to assume you have at least read the stuff with the Blind Login because that opens with a section that tells you about your RPi’s IP address and your going to need that.

reboot

at this point you just need your RPi running you don’t need to login the ftp does its own login.

If you fire up core now you will be able to get a connection using the ip address of your RPi and user of anonymous core has a tick box for this but you will not be able to do much because the default settings of vsftpd.conf are fairly restrictive.

But in the Local window you have a tree of your PC and in the remote window you should have a folder icon followed by two dots.

This indicates you have a connection but if you try to do anything useful it will probably fail do not worry if you don't see this.

OK you need to get yourself to a position where you are logged into your RPi either directly on a TV using Composite or HDMI or remotely using Putty or the like and an ssh connection.

Either way you should be able to see the RPi Wheezy command line prompt

pi@raspberrypi ~ $

enter sudo su

sudo su

the prompt should change to technically this is the bash shell and you are operating as the super user root but do not worry about this here. Your prompt should look like this.

root@raspberrypi:/home/pi#

This indicates you are logged in as root with all that this implies and your working directory is

/home/pi

If you were on a windows PC that would be like C:\home\pi

Note the slashes point the opposite way in Linux (Unix etc) the leading slash says root

If you are planning on playing in the deep end of command line Linux it may be worth picking up the Linux Pocket Guide published by O’Reilly it’s not always the easiest to understand but it’s cheap and it will tell you what a command does.

There’s plenty of online help but I find you can all too easily be diverted it will not do you any harm to get familiar with the following three commands.

cd = change directory pwd = print working directory ls = list files

the dos equivalents are

cd = cd pwd = there is no equivalent you are expected either know or read the prompt. ls = dir

It’s probably a good time to have an explore of the file space if you have run the sudo su as suggested then you are logged as root the super user and typing cd on its own will change your working directory to root.

cd / Note the space between cd and / will take you to the root of the RPi drive and an ls at this point will show you the root structure and it is worth knowing that the whole of the structure of the operating system is visible.

Everything (And I mean Everything) in Unix/Linux is a file so the hardware is here as well as the software so do not go deleting stuff unless you want to cultivate familiarity with the re-image process :D

However the back face to this warning is that anything you do can be undone by re-imaging your SD card. NOTE Boring

So we need to navigate to the etc. folder and to edit the configuration file for vsftpd you can edit without the navigation but it will be worth your while as a noob to understand what is going on and practice moving around.

So cd /etc ls Remember there is a space between the cd and the /etc so you are looking at the long list of stuff in the etc folder you are going to edit one of the core files of Wheezy that is vsftpd.conf.

Now I have a preference for nano as an editor of choice there are others feel free to explore note pico is the same as nano and if I explain using nano at least for now you will know what is happening so

nano vsftpd.conf

Now the vsftpd.conf file looks daunting but the commenting is excellent any line that starts with the hash (#) is a comment and the remainder of that line is ignored.

To activate the line remove the hash.

Example of making changes in vsftpd.conf
Lets look at one small section so you can follow this. Find the following part

# #
 * 1) Run standalone with IPv6
 * 2) Like the listen parameter, except vsftpd will listen on a IPv6 socket
 * 3) instead of an IPv4 one.  This parameter and the listen parameter are mutually
 * 4) exclusive
 * 5) listen_ipv6=YES

For the time being you do not want to worry about what IPv6 (Internet Protocol version 6) is for now nuff said it is the future of IP and for now it is not that widely supported by the service providers.

Ok hash (#) on it’s own is a blank line (white space to make the file easier to read).

The next three lines tell you what the command does.

It also tells you that this command and the listen command (it is earlier in the file) are “mutually exclusive”

This means you can either listen (listen happens to imply listen using IPv4) or listen_ipv6 but not both so if you remove the hash here you need to put on onto the start of the listen=YES line.

By default IPv4 uses port 21 for ftp transfers IPv6 doesn’t for now that’s probably enough about that.

So if you want to BREAK vsftpd so it does not work then remove the hash from the
 * 1) listen_ipv6=Yes

line but the suggestion is leave it alone this is just an example.

Note these two following links are not uploaded yet...

Here is a link to my un altered original vsftpd.conf

Here is a link to my modified one

What follows is some detail of the changes.

The first change I would suggest you actually do is enable (remove the hash and the space from the start of) the line write_enable= YES so that the line starts hard left (note no leading spaces)

So that it looks like

write _enable= YES

now change the line #anon_upload_enable=YES by removing its hash and change the Yes to a NO

so it reads

anon_upload_enable=NO

Here are the remaining changes
local_enable=YES

local_unmask=022

anon_upload_enable

ascii_upload_enable=YES

ascii_download_enable=YES

How to exit the editor saving the changes
Ok we need to write these changes to the saved file so [Ctrl][x] (that’s if you are using nano or pico)

Notice the highlighted line at the bottom of the page.

You need to hit the “y “ key just to get to the next stage.

Enter accepts the given name and drops you back to the prompt now you need to reboot so type reboot and wait till your RPi has restarted.