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

From eLinux.org
Jump to: navigation, search
m (Run yor FTP Client Example here uses Core FTP Lite)
m (Example of making changes in vsftpd.conf)
 
(5 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
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.   
 
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 .
+
'''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.   
 
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.   
Line 13: Line 13:
 
You should have your router secured with a good password for administration and for wi-fi if it has it.     
 
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.   
+
== 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.   
 
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.   
+
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.   
 
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.   
Line 23: Line 25:
 
[http://www.coreftp.com/download.html Core FTP Lite]
 
[http://www.coreftp.com/download.html Core FTP Lite]
  
and “filezilla” which comes from the same family as firefox.   
+
There is also “Filezilla” which comes from the same software family as firefox.   
  
 
[http://filezilla-project.org/download.php/ Filezilla]
 
[http://filezilla-project.org/download.php/ Filezilla]
  
I find core easier.   
+
I personally 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
+
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
  
 
[http://www.cuteftp.com/trial.aspx Cute FTP]
 
[http://www.cuteftp.com/trial.aspx Cute FTP]
  
In reality it does not mater which you choose.   
+
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 visible across the internet.   
+
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.   
  
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.   
+
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 and their derivatives (Ubuntu, Raspibian, Wheezy etc.) come with a package available via the apt-get route.   
+
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.   
+
The package is vsftpd ('''V'''ery '''S'''ecure '''FTP''' '''D'''aemon) 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.   
 
Note neither are essential they just may make your life easier.   
Line 47: Line 49:
 
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.   
 
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.
+
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 ==
+
== Installing vsftpd & Editing the vsftpd.conf ==
  
 
Heads up either at the start of the session type
 
Heads up either at the start of the session type
Line 73: Line 75:
 
at this point you just need your RPi running you don’t need to login the ftp does its own login.
 
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.   
+
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.   
 
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.   
+
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.   
 
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.   
Line 89: Line 91:
 
  sudo su
 
  sudo su
  
the prompt should change to technically this is the bash shell but do not worry about this here
+
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#
 
  root@raspberrypi:/home/pi#
Line 101: Line 103:
 
Note the slashes point the opposite way in Linux (Unix etc) the leading slash says root  
 
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.   
+
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 to easily be diverted it won’t do you any harm to get familiar with the following
+
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
 
  cd = change directory
Line 115: Line 117:
 
  ls = dir
 
  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.   
+
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/ 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.   
+
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
 
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.
+
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.   
+
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
 
So
Line 129: Line 131:
 
  ls
 
  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.  
+
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
 
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
Line 135: Line 137:
 
  nano vsftpd.conf
 
  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
+
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.   
 
  
 +
To activate the line remove the hash.
  
 
== Example of making changes in vsftpd.conf ==
 
== Example of making changes in vsftpd.conf ==
Line 153: Line 154:
 
  #   
 
  #   
  
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.   
+
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).   
 
Ok hash (#) on it’s own is a blank line (white space to make the file easier to read).   
Line 161: Line 162:
 
It also tells you that this command and the listen command (it is earlier in the file) are “mutually exclusive”
 
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.   
+
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
+
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
 
So if you want to BREAK vsftpd so it does not work then remove the hash from the
Line 179: Line 180:
 
What follows is some detail of the changes.   
 
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)
+
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
 
So that it looks like

Latest revision as of 02: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.

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

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

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

Run yor FTP Client Example here uses Core FTP Lite