# Simple Apache 2 setup



## bobwills (Feb 17, 2014)

Howdy,

I am a high school teacher and I'm trying to allow my students to "ftp" onto our local(in house) Apache2 web server on Ubuntu 10.10. I know the local ip address. It is: 10.127.1.58 My students have folders inside it such as: 10.127.1.58/bob.wills We have been using a "usb memory stick" to transfer their files on to it so they can view their work from Firefox or IE. I have the students login as users and they are directed to their appropriate web folder on the server to copy their work from the "usb stick", so I know my permissions are correct. I also have a cgi-bin installed at: /usr/lib/cgi-bin and it works perfectly as we have been running forms I put there for them. 

The problem: They cannot "ftp" into their folder!!! The error log tell me nothing as they just can't get through. I have read and read about all I can find, but I don't really know how to set the Apache2 server up to accept them using "ftp" tools. I'd like to do this as the "usb stick" method is soooo slow! Does anyone have a sample of setting and configs I can use? What am I missing? It is a synaptic Apache2 basic install with perl and php. :banghead:

Thanks bunches!!!!


----------



## Fjandr (Sep 26, 2012)

I'm not sure what process you're describing by "I have the students login as users and they are directed to their appropriate web folder on the server to copy their work from the "usb stick", so I know my permissions are correct."

I assume they're logging in via a web browser, but the above is not necessarily an FTP connection.

Apache is a hypertext server, not an FTP server. Typically you will need to set up an FTP daemon separately in order to have FTP access.

One such daemon would be VSFTP. I don't routinely use Synaptic, but from the command line installing it would be

```
sudo apt-get install vsftpd;sudo mkdir /srv/ftp;sudo usermod -d /srv/ftp ftp;
```
Then you'd need to enable authenticating system users by editing /etc/vsftpd.conf and making sure two lines exist:

```
local_enable=YES
write_enable=YES
```
Then restart the daemon:

```
sudo /etc/init.d/vsftpd restart
```
You'd copy user directories into /srv/ftp, and iptables (or whatever firewall is in use on the server) would need to allow incoming tcp connections on port 21.


----------



## bobwills (Feb 17, 2014)

Thank you!!! As it turned out, the "ftpd" deamon was exactly what I needed(along with "ftp"). Thanks for your answer. It will now be much better in class and of course classroom management. :grin:


----------



## Fjandr (Sep 26, 2012)

You're quite welcome, happy to help. :smile:

Note: Since you're dealing with students and (presumably) homework, you may want to make sure your FTP daemon runs in a chroot environment. Basically, that restricts the highest directory into which a given user may change. In ordinary practice that would typically be their home directory, preventing them from accessing system files or the files of other users.


----------



## bobwills (Feb 17, 2014)

Thanks again Fjandr !!! I will do that exactly when I get to school today. Tomorrow we will start our "ftp" process for the students.  I tested it on my laptop test-bed and I have the setup down to duplicate.


----------



## Fjandr (Sep 26, 2012)

Hopefully things go smoothly. Feel free to post back if you have issues getting it set up and working how you want it to.


----------



## bobwills (Feb 17, 2014)

Howdy Fjandr,

Thanks so much for your help!!! We can now "ftp" onto the server and "ftp" files back to the user's local computer, but have these issues.

We cannot change file permissions of the files on the server using any "ftp" tool.
We cannot "ftp" files into/onto their respective web folders to add or replace existing files.

I have done these:
Checked and set file permissions to 755 and even 777 just to try it.
I added each student to the "www-data" and "ftp" groups.
The "ftp server and of course "Apache2" are up and running.

I get this message from my "gftp" software:
When trying to "ftp" upload any file I get "550 Permission denied". And of course I get the same error when trying to create a folder on the server using any "ftp" tool.
When trying to change permissions of a file using any "ftp" tool, I get "500 Unknown SITE command".

I am puzzled to say the least. :banghead: Do you have any ideas? I am re-reading the vsftp.conf file and Apache2.conf files again to see if I missed something.

Thanks bunches!!! :grin:


----------



## Fjandr (Sep 26, 2012)

Did you verify that the write_enable=YES line in vsftpd.conf was uncommented? That means it should not have a # character at the start of the line.


----------



## bobwills (Feb 17, 2014)

Thanks Fjandr!!! That was it... At least here on my laptop at home. I think it will work at school also. I got it to work by also restarting both Apache2 and then vsftpd. Muchos gracias!!! :dance:


----------



## Fjandr (Sep 26, 2012)

Quite welcome. And yes, any time you make changes to .conf files you'll need to restart the service in order for your changes to take effect.


----------

