LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2005, 10:31 PM   #1
spankmeister7
LQ Newbie
 
Registered: Jan 2003
Posts: 8

Rep: Reputation: 0
frustrated with apache2 and vsftp


Right.

All I'm trying to do is to make it so a system user (we'll call them 'webguy') can FTP into the root directory of the apache web server and upload and change files. Doesn't seem like too much too ask for.

I'm not (yet) using virtual hosts.

I have installed Apache2 and vsftp. I've tried changing the home directory of webguy to /var/www/localhost/htdocs. This will allow webguy to land in the right directory, but not upload anything. Initially all the folder/file permissions were set for root:root. I changed it to apache:apache and added webguy to the apache group. Still doesn't work.

Next I tried to create a symlink from /var/www/localhost/htdocs to /home/webguy/web and changed his home directory back to /home/webguy. But I still don't have permission to upload files.

This is taking all day. I really don't know what do to.

Is there something terribly and painfully obvious that I'm missing?
 
Old 09-12-2005, 01:04 AM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
You could create a folder called upload, change the own to webguy ("chown webguy upload", I think) and make sure that he has right to both read and write to that folder (chmod +rw upload)

The symlink should work as well, just so the owner is webguy and he has full read and write permissions for it
 
Old 09-12-2005, 10:22 AM   #3
spankmeister7
LQ Newbie
 
Registered: Jan 2003
Posts: 8

Original Poster
Rep: Reputation: 0
need more specifics

Thanks for the reply, but it doesn't really answer the question. I know that the symlink *should* work, but it doesn't. And I don't know why I should make an upload folder to send files to when I want them to be placed in the htdocs folder.


This must be a very common issue.
 
Old 03-22-2006, 11:46 PM   #4
TongueTied
Member
 
Registered: Aug 2003
Distribution: SuSE 8.1 pro
Posts: 94

Rep: Reputation: 15
I have found the same problem. Have you found a solution?
 
Old 03-23-2006, 02:38 AM   #5
TongueTied
Member
 
Registered: Aug 2003
Distribution: SuSE 8.1 pro
Posts: 94

Rep: Reputation: 15
Found a solution. Symlinks won't work because with chroot_local_user=YES restricts the user to their /home/ directory and the symlink is trying to get out of that home directory. The solution is to use:

mount --bind /target_directory/ /new_directory_in_home_path/
 
Old 03-23-2006, 03:04 AM   #6
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
@spankmeister7, if I were you I'd stick with the apache:apache approach on /var/www/localhost/htdocs and
making that the FTP user's home directory. Creating a mount for something this easy is overkill, in my book,
unless webguy is supposed to do other things besides uploading to the website.

If you want to enable chroot for security (to disallow "webguy" to go out of /var/www/localhost/htdocs), use
the home directory /var/www/localhost/htdocs/./ and enable the chroot_local_user=YES vsftpd option as TongueTied suggested. You may want to create the directory /var/www/localhost/htdocs/bin/ and put some basic commands like "ls" in there, otherwise your chroot'ed webguy user won't be able to list the directory contents.

Also, have you verified that the vsftpd config allows for uploads? File and directory permissions are one thing, but vsftpd has some config options on top of those (to allow/disallow delete/upload (write)/download for all ftp users (including virtual ones) or even on a per-user basis).
 
Old 03-23-2006, 11:30 AM   #7
seanhharrison
Registered User
 
Registered: Aug 2003
Distribution: Red Hat
Posts: 3

Rep: Reputation: 0
timmeke,

> You may want to create the directory /var/www/localhost/htdocs/bin/ and put some
> basic commands like "ls" in there, otherwise your chroot'ed webguy user won't be
> able to list the directory contents.

I don't think spankmeister need to do this. Doesn't the vsftpd.conf param "dirlist_enable" provide this? It seems to for me.
 
Old 03-24-2006, 02:07 AM   #8
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
@seanhharrison,

dirlist_enable is a vsftpd option, that works regardless of the underlying filesystem.
Simply said, it allows you to disable directory listings, even if the "ls" program is available and the FTP "ls" command should normally work.
However, the chroot affects the underlying filesystem. By chroot'ing, you can make it impossible for the chroot'ed program to find the "ls" program to actually produce the listing (many FTP programs do not create the listing themselves, but rather use the standard Linux programs like "ls"). So, even if you would enable directory listings via the option, I doubt that vsftpd could create a listing, simply because it can't find "ls" in the chroot jail (unless it's provided). But you can always try that...

Copying simple programs like "ls" into a chroot jail is common practice, not only for FTP servers, but for all chroot jails.
 
Old 03-24-2006, 03:36 PM   #9
seanhharrison
Registered User
 
Registered: Aug 2003
Distribution: Red Hat
Posts: 3

Rep: Reputation: 0
Fair enough. I used to have to do that with wu-ftpd, but haven't even thought about it since moved to vsftpd...
 
Old 03-24-2006, 07:38 PM   #10
dopehouse
Member
 
Registered: May 2004
Location: Hildesheim(Germany)
Distribution: Debian Etch with Kernel 2.6.x (latest vanila)
Posts: 62

Rep: Reputation: 15
Hmm, I think you don't need to make local copies of some files in bin/ because the standard anonymous don't have them too. And the anonymous is in a chroot jail too.

So just do a
Code:
usermod -d /var/www/localhost/htdocs/ webguy
if that doesn't work, you can change back to the old home-dir by replacing /var/www/localhost/htdocs/ with /home/webguy/
 
  


Reply



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
Apache2.0.52, t1lib-5.0.2, php-apache2-5.0.2 wizard7423 Slackware 2 04-04-2011 08:09 PM
New and frustrated galantesghost LinuxQuestions.org Member Intro 2 09-11-2005 04:16 PM
Apache2 apache2-common WebDav timgerr Linux - Networking 1 08-25-2005 09:41 PM
how to uninstall apache2 which is installed by emerge apache2 flybirdlong Linux - Software 1 07-17-2004 11:46 AM
Frustrated Linuxfrog Linux - Hardware 2 06-23-2004 05:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:20 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration