Difference between revisions of "RPi Noob Guide for Wheezy and vsftpd"

From eLinux.org
Jump to: navigation, search
m (Example of making changes in vsftpd.conf)
m (Example of making changes in vsftpd.conf)
Line 169: Line 169:
 
  #listen_ipv6=Yes  
 
  #listen_ipv6=Yes  
  
'''line but the suggestion is leave it alone this is just an example'''.  
+
'''line but the suggestion is leave it alone this is just an example.'''   
  
 
'''Note these are not uploaded yet...'''
 
'''Note these are not uploaded yet...'''
 +
 
[[Here is a link to my un altered original vsftpd.conf]]
 
[[Here is a link to my un altered original vsftpd.conf]]
  
[[Here is a link to the modified one]]
+
[[Here is a link to my modified one]]
  
 
What follows is some detail of the changes.   
 
What follows is some detail of the changes.   
Line 183: Line 184:
  
 
  write _enable= YES
 
  write _enable= YES
 
  
 
now change the line #anon_upload_enable=YES by removing its hash and change the Yes to a NO
 
now change the line #anon_upload_enable=YES by removing its hash and change the Yes to a NO

Revision as of 08:23, 6 August 2012

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.

And 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.

As this is noob territory I 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’s 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

and “filezilla” which comes from the same family as firefox.

Filezilla

I find core easier.

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

Cute FTP

In reality it does not mater which 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 visible across the internet.

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

Debian Linux and Fedora and their derivatives (Ubuntu, Raspibian, Wheezy etc.) come with a package available via the apt-get 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.

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 get a connection using the ip address of your RPi and user of anonymous but you will not be able to do much because the default settings of vsftpd 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.

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 but do not worry about this here

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 endof 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 to easily be diverted it won’t do you any harm to get familiar with the following

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 then you are logged as root the super user and typing cd on its own will change your working directory to root.

cd/ will take you to the root of the RPi drive and an ls at this point will show you the root structure and it’s 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 side to this warning is that anything you do can be undone by re-imaging your SD card.

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.

So

cd /etc
ls

note 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 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

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

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

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

#listen_ipv6=Yes 

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

Note these 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 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.

Run yor FTP Client Example here uses Core FTP Lite