View Full Version : Getting Apache to link to FTP directory

05-03-2005, 09:46 PM
OK, I know I had gotten this working before, but that was possibly 4 years ago so I partially remember the exact steps I took.

I'm running Fedora core 3, /etc/httpd/conf/ is where the httpd.conf files are, /var/www/html/ is the root of where the pages are served, /var/ftp/ is the ftp directory I want to show up when http://ip_address/ftp/ is used.

What I tried, editted httpd.conf and added the lines:

Alias /ftp/ "/var/ftp/"

Thought maybe Apache didn't allow access out of /var/www/ so I created an link to that directory, /var/www/ftp/ then changed the Alias /ftp/ "/var/www/ftp/"

Error is a 403 Forbidden, Don't have permission to access /ftp/ on this server, or something along the lines of that. (is the only error I get trying to access /ftp/)

So I thought it might be permissions, and why not, Apache runs as apache I believe, and I doubt if the user apache has access to /var/ftp/ but to be honest, it should still have read/execute access having 755 permission.

I may have configured vsftpd directory path to reside actually inside the /var/www directory when I got it working, but I would really prefer to leave it where it is and hopefully figure out how to get apache to access that directory.

I also added

<Directory /var/www/ftp/>
Order allow,deny
Allow from all

Still no go. So any ideas, my last resort is editing vsftpd.conf and making it reside inside /var/www/ but if I can eliminate this way, It would be better.

Also added the link of /var/ftp/pub/ inside /var/www/html/ftp/ where ftp was just a new directory and not a link. This still resulted in a 403.

Thanks in advance,


06-03-2005, 12:14 AM
A couple of things come to mind.

mount --bind /var/www/html /home/username
^^ will re-mount the filesystem...
You might also like to try re-creating a user, but specifying the /home/user folder as something else (man useradd).

IIRC its: useradd kame -m -G users,audio,wheel,games -s /bin/bash -k /var/www/html



06-03-2005, 12:57 AM
Cheers Chill,

I remembered that command, now, I've done so many things to folders etc, that I can't give the correct method to do it, so I'll put down everything I've done, and maybe if I can resort to an earlier back up and perform individual tests on the subject to clear this up.

So here goes everything I did, but without all the trial and errors:
su -
mkdir /var/www/ftp
rmdir /var/ftp/pub
chcon -R -h -t httpd_sys_content_t -u system_u /var/www/ftp
mkdir /var/www/ftp/pub
chmod 755 /var/www/ftp
mount --bind /var/www/ftp /var/ftp

then edit httpd.conf and add:

Alias /ftp/ "/var/www/ftp"
<Directory /var/www/ftp/>
Options Indexes
Order allow,deny
Allow from all

back to console:

service httpd restart

then try it out.


Graham L
06-03-2005, 02:40 PM
Hasn't your mount command got the directory names in the wrong order? (mount A B mounts A on B, not B on A)

Doesn't apache use chroot to limit what's accessible to it? Do soft links survive that? Mounting should.

I'm sure the apache docs talk about this, but it's been a long time since I've looked at it.