LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-25-2004, 09:27 AM   #1
Mankind75
Member
 
Registered: Apr 2004
Location: Brome, Lower Saxony, Germany
Distribution: Slackware, OpenMandriva
Posts: 71

Rep: Reputation: 17
Post Apache Root/Home Directory and setting up FTP for home directories?


I am currently planning to set up a web server and I have a fresh install of Mandrake 10 with Apache 2 running. I now want to add content to my web server but I don't know where to put the files. Does content go into /var/www/html? Also I wanted to set up FTP access so people can upload pages to home directories. I noticed that some servers are configured to have a public_html directory in the home dir but how would I set up Apache and FTP etc. to do this?
 
Old 06-25-2004, 09:54 AM   #2
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Most of that is done in the httpd.conf file. You need to look in /etc/httpd/conf/httpd.conf or if you can't find it there, you should serch your machine for httpd.conf.

You need to change the DocumentRoot which defines the physical path on your machine where files are served from. Right now it's probably set for /var/www/html, but you can change this to whatever you want.

In my case, I'm doing it with /home/username/www/html. And yes, you can use either public_html or just html, or whatever you want, really.

I recommend setting up your system with user accounts created using "useradd" (the typical way you add users to your system) and use something like ProFTPd which will jail users to their home directories as defined in the /etc/passwd file. In your apache config file, you can setup virtual hosts with the document roots as I described earlier with /home/username/html or /home/username/www/html or whatever you want to do.
 
Old 06-25-2004, 10:26 AM   #3
Mankind75
Member
 
Registered: Apr 2004
Location: Brome, Lower Saxony, Germany
Distribution: Slackware, OpenMandriva
Posts: 71

Original Poster
Rep: Reputation: 17
Post

Wow that was a quick reply. More important things start making sense now. Thanks! Will let you know how I get on.
 
Old 06-25-2004, 11:49 AM   #4
gbrewste
Member
 
Registered: Jun 2004
Location: Illinois
Distribution: Fedora 2
Posts: 44

Rep: Reputation: 15
Man, I love this board. I was just going to try to search for an answer to a similar question and found this thread right away which gets me about 75% of the way to my solution.

I think I can figure out the other 25%

THANKS DONBOY
 
Old 06-28-2004, 04:23 AM   #5
Mankind75
Member
 
Registered: Apr 2004
Location: Brome, Lower Saxony, Germany
Distribution: Slackware, OpenMandriva
Posts: 71

Original Poster
Rep: Reputation: 17
cgi-bin settings

Okay I have both Apache and FTP set up but another question came up. I am planning to install an Image Gallery which requires a cgi-bin directory (it is written in Perl). Is it enough to create a directory named 'cgi-bin' in the users home directory and upload the Perl scripts in there or are there any other changes I would need to make?
 
Old 06-28-2004, 06:39 AM   #6
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
You'll need this (located anywhere you want) in the config file...

Code:
<Directory "/home/*/www/html/cgi-bin">
	Options +ExecCGI
</Directory>
Just replace the path above with the path to your actual cgi-bin. The important part is the +ExecCGI which adds this functionality to the directory you've chosen.

That's it, really. Also be aware that asterisk's work here just like they do at the shell. which means, the example I'm showing above will activate ExeCGI for all paths on your server that match this string. In my case, I've got a whole bunch of users who have accounts setup the same way, so I can enable cgi-bin's on all of their accounts using this simple statement and I don't need to make seperate ones for each account, which becomes a pain everytime I need to add another user.

And yes, you'll need to create this directory.

Also, another nugget that may be important for you...

If your cgi script will be creating any new files (like if you had a message board that writes new files all the time) those files will be written with "apache" as the owner. This becomes a real pain when you want to have the admin for that website able to FTP into their account and manipulate those files. They will not be able to delete those files because they are not the owner of the files! Unless you have them logging in as the apache user, which is a bad idea because what happens when you want to let other people login using FTP? You can't have everyone logging in via FTP as the apache user!

The solution here is to use "suexec" which allows a virtual host to run as a specified user. So in the vhost stanza, you have the following line...

Code:
SuexecUserGroup user group
Where "user" is the user you want apache to run as, and "group" is the group you want apache to run as. What happens now is... when files are created by a cgi script anywhere under that document root, they are created with the user/group you specify. This way, when people login using FTP, they are able to manipulate those files because they are the owner of the files that were written.

Hope that helps.
 
Old 07-23-2006, 02:37 PM   #7
jonty_11
Member
 
Registered: Sep 2004
Posts: 127

Rep: Reputation: 15
Apache on FC5 (2.6.17-1.2157_FC5)- Forbidden Error
Access provided via User Directories: here is relevant portion of httpd.conf (Same httpd.conf file works fine on another FC5 machine - 2.6.16-1.2096_FC5):

#UserDir disable UK

#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#UK
UserDir public_html

</IfModule>

#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#UK
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
#UK
########################################################################
I have following at the end of the httpd.conf file. But when I try to access the User Directory via HTTP (http://<ip of m/c>/~karihalo/vocal, I get error - 403.

########################################
## Added by allinoneconfigure
## vocalkey: html v1.1
########################################
Alias /vocal "/home/karihalo/public_html/vocal"
<Directory "/home/karihalo/public_html/vocal">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
########################################
## vocalkeyend: html v1.1
########################################
########################################
## Added by allinoneconfigure
## vocalkey: cgi v1.4
########################################
ScriptAlias /vocalconf/ "/home/karihalo/public_html/vocalconf/"
<Directory "/home/karihalo/public_html/vocalconf">
AllowOverride All
Options +ExecCGI
AddHandler cgi-script cgi pl pm
Order allow,deny
Allow from all
</Directory>
<Directory "/home/karihalo/public_html/vocalconf">
AllowOverride None
Options +ExecCGI
AddHandler cgi-script cgi pl pm
Order Deny,Allow
#Deny from all
Allow from 127.0.0.1
</Directory>
########################################
## vocalkeyend: cgi v1.4
########################################

Last edited by jonty_11; 07-23-2006 at 02:40 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP virtual users with different home directories remi Linux - Software 14 07-27-2009 11:20 AM
automount home directories with information from Active Directory (or NIS) alex r Linux - Software 5 08-30-2006 10:05 AM
ftp cannot cd to my home directory powah Linux - Software 0 06-03-2005 11:10 AM
apache login to home directories paul_mat Linux - Networking 1 04-05-2005 02:29 AM
root unable to create directories in /home? cpv204 Solaris / OpenSolaris 6 11-25-2003 10:33 AM


All times are GMT -5. The time now is 04:52 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration